zrok/controller/store/limitCheckLock.go

20 lines
567 B
Go
Raw Normal View History

2024-05-15 20:31:26 +02:00
package store
import (
"github.com/jmoiron/sqlx"
"github.com/pkg/errors"
)
func (str *Store) LimitCheckLock(acctId int, trx *sqlx.Tx) error {
2024-05-15 21:48:42 +02:00
if str.cfg.EnableLocking {
stmt, err := trx.Prepare("insert into limit_check_locks (account_id) values ($1) on conflict (account_id) do update set updated_at = current_timestamp")
if err != nil {
return errors.Wrap(err, "error preparing upsert on limit_check_locks")
}
if _, err := stmt.Exec(acctId); err != nil {
return errors.Wrap(err, "error executing upsert on limit_check_locks")
}
2024-05-15 20:31:26 +02:00
}
return nil
}