From c6dd6ccc68d98c2038c2679f99617a5d4a3321c6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Nov 2022 07:18:38 +0530 Subject: [PATCH] Apparently github's deletion api is flakey, retry --- publish.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/publish.py b/publish.py index 1fb4b2187..d53d4a264 100755 --- a/publish.py +++ b/publish.py @@ -285,6 +285,7 @@ class GitHub(Base): # {{{ upload_url = release['upload_url'].partition('{')[0] asset_url = f'{self.url_base}/assets/{{}}' existing_assets = self.existing_assets(release['id']) + original_existing_assets = existing_assets.copy() def delete_asset(asset_id: str) -> None: r = self.requests.delete(asset_url.format(asset_id)) @@ -317,10 +318,9 @@ class GitHub(Base): # {{{ try: asset_id = r.json()['id'] except Exception: - pass - else: - self.info(f'Deleting {fname} from GitHub with id: {asset_id}') - delete_asset(asset_id) + asset_id = original_existing_assets[fname] + self.info(f'Deleting {fname} from GitHub with id: {asset_id}') + delete_asset(asset_id) time.sleep(sleep_time) if self.is_nightly: