Skip to content

Commit ff0d235

Browse files
author
Andrei Neagu
committed
fixed borken test
1 parent 3fd82a5 commit ff0d235

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

packages/service-library/src/servicelib/docker_utils.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,18 +268,23 @@ def _reset_progress_from_previous_attempt() -> None:
268268
pulled_status.downloaded = 0
269269
pulled_status.extracted = 0
270270

271+
attempt: NonNegativeInt = 1
272+
271273
@retry(
272274
wait=wait_random_exponential(),
273275
stop=stop_after_attempt(retry_upon_error_count),
274276
reraise=True,
275277
retry=retry_if_exception_type(asyncio.TimeoutError),
276278
)
277279
async def _pull_image_with_retry() -> None:
278-
# for each attempt rest the progress
279-
progress_bar.reset()
280-
_reset_progress_from_previous_attempt()
281-
282-
_logger.info("trying to pull image='%s'", image)
280+
nonlocal attempt
281+
if attempt > 1:
282+
# for each attempt rest the progress
283+
progress_bar.reset()
284+
_reset_progress_from_previous_attempt()
285+
attempt += 1
286+
287+
_logger.info("attempt '%s' trying to pull image='%s'", attempt, image)
283288

284289
reported_progress = 0.0
285290
async for pull_progress in client.images.pull(

0 commit comments

Comments
 (0)