cheeky little time optimization

This commit is contained in:
tobi 2025-03-03 14:50:43 +01:00
commit d5f4254862

View file

@ -204,8 +204,8 @@ func (ts *tokenStore) getUpdateToken(
// If token was last used more than // If token was last used more than
// an hour ago, update this in the db. // an hour ago, update this in the db.
wasLastUsed := token.LastUsed wasLastUsed := token.LastUsed
if time.Since(wasLastUsed) > 1*time.Hour { if now := time.Now(); now.Sub(wasLastUsed) > 1*time.Hour {
token.LastUsed = time.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 {
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