mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01:00
20 lines
567 B
Go
20 lines
567 B
Go
package store
|
|
|
|
import (
|
|
"github.com/jmoiron/sqlx"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func (str *Store) LimitCheckLock(acctId int, trx *sqlx.Tx) error {
|
|
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")
|
|
}
|
|
}
|
|
return nil
|
|
}
|