Fix some problems with off by one in the id condition when deleteing temporary access tokens.
This commit is contained in:
parent
f7b5221391
commit
24ab0ae53a
1 changed files with 4 additions and 4 deletions
|
@ -8,10 +8,10 @@ from app import app
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
BATCH_SIZE = 5000
|
||||
BATCH_SIZE = 1000
|
||||
|
||||
def delete_temporary_access_tokens(older_than):
|
||||
# Find the higest ID up to which we should delete
|
||||
# Find the highest ID up to which we should delete
|
||||
up_to_id = (AccessToken
|
||||
.select(AccessToken.id)
|
||||
.where(AccessToken.created < older_than)
|
||||
|
@ -29,9 +29,9 @@ def delete_temporary_access_tokens(older_than):
|
|||
start_time = datetime.utcnow()
|
||||
(AccessToken
|
||||
.delete()
|
||||
.where(AccessToken.id > starting_at_id,
|
||||
.where(AccessToken.id >= starting_at_id,
|
||||
AccessToken.id < up_to_id,
|
||||
AccessToken.temporary == 1,
|
||||
AccessToken.temporary == True,
|
||||
~(AccessToken.id << access_tokens_in_builds))
|
||||
.execute())
|
||||
|
||||
|
|
Reference in a new issue