mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-23 15:06:15 -06:00
cheeky little time optimization
This commit is contained in:
parent
668dbf2b4d
commit
d5f4254862
1 changed files with 2 additions and 2 deletions
|
|
@ -204,8 +204,8 @@ func (ts *tokenStore) getUpdateToken(
|
|||
// If token was last used more than
|
||||
// an hour ago, update this in the db.
|
||||
wasLastUsed := token.LastUsed
|
||||
if time.Since(wasLastUsed) > 1*time.Hour {
|
||||
token.LastUsed = time.Now()
|
||||
if now := time.Now(); now.Sub(wasLastUsed) > 1*time.Hour {
|
||||
token.LastUsed = now
|
||||
if err := ts.state.DB.UpdateToken(ctx, token, "last_used"); err != nil {
|
||||
err := gtserror.Newf("error updating last_used on token: %w", err)
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue