Skip to content

Commit

Permalink
Merge pull request #522 from Backblaze/catch_timeout
Browse files Browse the repository at this point in the history
Add upload token reset after upload timeout
  • Loading branch information
ppolewicz authored and mlech-reef committed Nov 26, 2024
2 parents 26f45a5 + bcf467c commit 2cc3e06
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions b2sdk/_internal/b2http.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,8 @@ def _translate_errors(cls, fcn, post_params=None):
# an upload request for cause, so we use a 400 Bad Request
# code.
raise BrokenPipe()
elif isinstance(e2, TimeoutError):
raise B2RequestTimeout(str(e0))
raise B2ConnectionError(str(e0))

except requests.Timeout as e:
Expand Down
3 changes: 2 additions & 1 deletion b2sdk/_internal/bounded_queue_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def submit(self, fcn, *args, **kwargs):
def run_it():
try:
return fcn(*args, **kwargs)
except Exception:
except Exception as exc:
print(exc)
self.num_exceptions += 1
raise
finally:
Expand Down
1 change: 1 addition & 0 deletions changelog.d/+17dd34ae.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add upload token reset after upload timeout.

0 comments on commit 2cc3e06

Please sign in to comment.