Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid nested retries for publish #131

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading