service keys: fix stale query
This commit is contained in:
parent
bbaeaffbdb
commit
c79bb14049
1 changed files with 3 additions and 3 deletions
|
@ -15,9 +15,9 @@ def _expired_keys_clause(service):
|
|||
|
||||
|
||||
def _stale_unapproved_keys_clause(service):
|
||||
return ((ServiceKey.service >> service) &
|
||||
return ((ServiceKey.service == service) &
|
||||
(ServiceKey.approval >> None) &
|
||||
(ServiceKey.created_date + UNAPPROVED_TTL) >= datetime.utcnow())
|
||||
(ServiceKey.created_date <= (datetime.utcnow() - UNAPPROVED_TTL)))
|
||||
|
||||
|
||||
def _gc_expired(service):
|
||||
|
@ -118,7 +118,7 @@ def _list_service_keys_query(kid=None, service=None, approved_only=False):
|
|||
|
||||
if service is not None:
|
||||
query = query.where(ServiceKey.service == service)
|
||||
query = query.where(~(_expired_keys_clause(service)) &
|
||||
query = query.where(~(_expired_keys_clause(service)) |
|
||||
~(_stale_unapproved_keys_clause(service)))
|
||||
|
||||
if kid is not None:
|
||||
|
|
Reference in a new issue