Skip to content

Commit

Permalink
Add exponential backoff for deletion failures.
Browse files Browse the repository at this point in the history
Fixes: #1657.

Note for potential broader use toward #1619.
  • Loading branch information
tseaver committed Mar 30, 2016
1 parent ae88612 commit 9bd2880
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion system_tests/logging_.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,18 @@ def setUp(self):
self.to_delete = []

def tearDown(self):
from gcloud.exceptions import NotFound
for doomed in self.to_delete:
doomed.delete()
backoff_intervals = [1, 2, 4, 8]
while True:
try:
doomed.delete()
break
except NotFound:
if backoff_intervals:
time.sleep(backoff_intervals.pop(0))
else:
raise

@staticmethod
def _logger_name():
Expand Down

0 comments on commit 9bd2880

Please sign in to comment.