Skip to content

Commit

Permalink
fix error in computation of cooldown period after sushi error 1020
Browse files Browse the repository at this point in the history
  • Loading branch information
beda42 committed Oct 23, 2020
1 parent b6a4907 commit b795683
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/sushi/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class SushiCredentialsAdmin(VersionAdmin):
'customer_id',
'requestor_id',
'enabled',
'when_can_access',
]
list_filter = ['enabled', 'counter_version', 'organization', 'platform']

Expand Down
2 changes: 1 addition & 1 deletion apps/sushi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def when_can_access(self, base_wait_unit=5) -> float:
if too_many_attempts:
seconds = base_wait_unit * 2 ** len(too_many_attempts)
last_timestamp = too_many_attempts[0]['timestamp']
diff = (last_timestamp + timedelta(seconds=seconds) - now()).seconds
diff = (last_timestamp + timedelta(seconds=seconds) - now()).total_seconds()
if diff > 0:
return diff
return 0
Expand Down

0 comments on commit b795683

Please sign in to comment.