1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-03-24 09:35:06 +00:00

Address review comments + more tests

This commit is contained in:
ItalyPaleAle
2026-03-04 20:25:01 -08:00
parent 62e7882493
commit 058ac29b8f
4 changed files with 124 additions and 3 deletions

View File

@@ -73,7 +73,10 @@ func (lv *lockValue) Unmarshal(raw string) error {
// Acquire obtains the lock. When force is true, the lock is stolen from any existing owner.
// If the lock is forcefully acquired, it blocks until the previous lock has expired.
func (s *AppLockService) Acquire(ctx context.Context, force bool) (waitUntil time.Time, err error) {
tx := s.db.Begin()
tx := s.db.WithContext(ctx).Begin()
if tx.Error != nil {
return time.Time{}, fmt.Errorf("begin lock transaction: %w", tx.Error)
}
defer func() {
tx.Rollback()
}()