Prevent infinite loop in token_flush

If there were > batch_size tokens with the same expiration time then
token_flush could hang because it picks the expiration time as the
target to delete with a < check.

The check is changed to a <= so that the tokens in the batch are
deleted so that token_flush always makes progress.

Change-Id: Id0b6f7fcdf7ebb02a6f38fbb9a4e25bf714a614c
Closes-Bug: #1387401
(cherry picked from commit 6bf78255b2)
This commit is contained in:
Brant Knudson 2014-10-29 19:17:45 -05:00
parent db291b340e
commit f54fa8fa56
1 changed files with 1 additions and 1 deletions

View File

@ -269,7 +269,7 @@ class Token(token.persistence.Driver):
total_removed = 0
upper_bound_func = timeutils.utcnow
for expiry_time in expiry_range_func(session, upper_bound_func):
delete_query = query.filter(TokenModel.expires <
delete_query = query.filter(TokenModel.expires <=
expiry_time)
row_count = delete_query.delete(synchronize_session=False)
total_removed += row_count