Skip to content

Commit

Permalink
Avoid nested retries for publish
Browse files Browse the repository at this point in the history
  • Loading branch information
nanonyme authored and barthalion committed Aug 26, 2024
1 parent ac62ecb commit 32c7b60
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions flat-manager-client
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,12 @@ async def upload_files(session, build_url, token, files):
elif resp.status != 200:
raise ApiError(resp, await resp.text())


@retry(
stop=TENACITY_STOP_AFTER,
wait=TENACITY_WAIT_BETWEEN,
retry=TENACITY_RETRY_EXCEPTIONS,
reraise=True,
)
async def upload_deltas(session, repo_path, build_url, token, deltas, refs, ignore_delta):
if not len(deltas):
return
Expand All @@ -278,7 +283,12 @@ async def upload_deltas(session, repo_path, build_url, token, deltas, refs, igno
if len(req):
await upload_files(session, build_url, token, req)


@retry(
stop=TENACITY_STOP_AFTER,
wait=TENACITY_WAIT_BETWEEN,
retry=TENACITY_RETRY_EXCEPTIONS,
reraise=True,
)
async def upload_objects(session, repo_path, build_url, token, objects):
req = []
total_size = 0
Expand Down Expand Up @@ -684,12 +694,6 @@ def build_url_to_api(build_url):
path = os.path.dirname(os.path.dirname(parts.path))
return urlunparse((parts.scheme, parts.netloc, path, None, None, None))

@retry(
stop=TENACITY_STOP_AFTER,
wait=TENACITY_WAIT_BETWEEN,
retry=TENACITY_RETRY_EXCEPTIONS,
reraise=True,
)
async def push_command(session, args):
local_repo = OSTree.Repo.new(Gio.File.new_for_path(args.repo_path))
try:
Expand Down Expand Up @@ -766,7 +770,7 @@ async def push_command(session, args):
update_job_url = build_url_to_api(args.build_url) + "/job/" + str(update_job_id)
if args.wait_update:
print("Waiting for repo update job")
update_job = await wait_for_job (session, update_job_url, token);
update_job = await wait_for_job(session, update_job_url, token);
else:
update_job = await get_job(session, update_job_url, token)
reparse_job_results(update_job)
Expand Down

0 comments on commit 32c7b60

Please sign in to comment.