unlock on error

This commit is contained in:
tobi 2025-03-03 14:53:18 +01:00
commit ea44883d2c

View file

@ -207,6 +207,8 @@ func (ts *tokenStore) getUpdateToken(
if now := time.Now(); now.Sub(wasLastUsed) > 1*time.Hour { if now := time.Now(); now.Sub(wasLastUsed) > 1*time.Hour {
token.LastUsed = now token.LastUsed = now
if err := ts.state.DB.UpdateToken(ctx, token, "last_used"); err != nil { if err := ts.state.DB.UpdateToken(ctx, token, "last_used"); err != nil {
// Unlock on error.
unlock()
err := gtserror.Newf("error updating last_used on token: %w", err) err := gtserror.Newf("error updating last_used on token: %w", err)
return nil, err return nil, err
} }