diff --git a/hubstorage/batchuploader.py b/hubstorage/batchuploader.py index 58ca8f5..ba86d6f 100644 --- a/hubstorage/batchuploader.py +++ b/hubstorage/batchuploader.py @@ -146,10 +146,13 @@ def _tryupload(self, batch): url = batch['url'] offset = batch['offset'] for retryn in xrange(self.worker_max_retries): - emsg = '' try: r = self._upload(batch) - r.raise_for_status() + + if r.status_code == 429 or (500 <= r.status_code < 600): + http_error_msg = '%s Server Error: %s' % (r.status_code, r.reason) + raise requests.HTTPError(http_error_msg, response=r) + if not (200 <= r.status_code < 300): logger.warning('Discarding write to url=%s offset=%s: ' '[HTTP error %s] %s\n%s', url, offset,