Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

[C-2164] add retry and requeue logic to download track jobs#2899

Merged
amendelsohn merged 6 commits into
mainfrom
amendel-offline-queue-retry
Feb 22, 2023
Merged

[C-2164] add retry and requeue logic to download track jobs#2899
amendelsohn merged 6 commits into
mainfrom
amendel-offline-queue-retry

Conversation

@amendelsohn

Copy link
Copy Markdown
Contributor

Description

  1. DownloadTrackWorker retries the download up to 3 times internally before putting down the job
  2. If the worker fails max times, re-enqueue the track to be tried again later
  3. If the re-queue count hits 3, abandon the job

Note: The job is still abandoned immediately if the track is unavailable for download or the job is otherwise invalid.

How Has This Been Tested?

Set downloadTrackAsync to fail 75% of the time. Tracks were succeeding at a high rate, and failed tracks would be processed again at the back of the queue. We successfully downloaded nearly all tracks even while the internal job was usually failing.

@amendelsohn amendelsohn requested review from a team and dylanjeffers February 22, 2023 00:12
Comment on lines +323 to +326
state.offlineQueue.push({
...action.payload,
requeueCount: action.payload.requeueCount + 1
})

@amendelsohn amendelsohn Feb 22, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like the check for MAX_RETRY_COUNT could happen here instead. Thoughts?

The reason I put it in the worker is so that we can use the proper abandonJob action, but I could also see setting it to ABANDONED state being a correct result of calling errorJob

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i agree with your thinking, could also maybe happen in the "processNextJob" main function?

@dylanjeffers dylanjeffers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think this is good as is, but it might be nice to consider where we put the retries, and where we decide to enque/set-state etc?

)
yield* put(completeJob({ ...queueItem, completedAt: Date.now() }))
yield* put(requestProcessNextJob())
for (let retryCount = 0; retryCount < MAX_RETRY_COUNT; retryCount++) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so is it possible to do retries just for the jobResult? i feel like abort and cancel happen when they should, like when we abort, we should not retry. maybe we can huddle about this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think you're right. I didn't figure out the structure in the moment, but I can see it now.

Comment on lines +323 to +326
state.offlineQueue.push({
...action.payload,
requeueCount: action.payload.requeueCount + 1
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i agree with your thinking, could also maybe happen in the "processNextJob" main function?

@pull-request-size pull-request-size Bot added size/M and removed size/L labels Feb 22, 2023
@amendelsohn amendelsohn merged commit 03a31ee into main Feb 22, 2023
@amendelsohn amendelsohn deleted the amendel-offline-queue-retry branch February 22, 2023 22:04
audius-infra pushed a commit that referenced this pull request Feb 25, 2023
[ef02ac1] Fix podfile, specify ruby-version (#2924) Dylan Jeffers
[c925cfe] Fix track play button (#2925) Michael Piazza
[6e3338b] [C-2201] Improve card list skeleton count (#2916) Dylan Jeffers
[c696519] [C-2207] Fix scrubber timestamp sync issues (#2912) Dylan Jeffers
[f9f5066] [C-2202] Sync legacy search history (#2915) Dylan Jeffers
[1c50935] [C-2193] Fix webview audio players on ios (#2922) Raymond Jacobson
[dd649d5] [C-1922] Fix mobile share encoding (#2918) Dylan Jeffers
[eb6b89e] Fix collectibles route (#2917) Dylan Jeffers
[efaa539] Fix lineup showing empty tile before fetch (#2911) Dylan Jeffers
[c77076a] comma (#2920) Marcus Pasell
[6041a40] [PAY-943] - Filter out download options for gated track (#2919) Saliou Diallo
[3b2ff6d] [DMs] RadioButton component and InboxSettingsModal (#2884) Marcus Pasell
[709dde5] [PAY-890] Add locked content modal (#2893) Saliou Diallo
[3d8912f] [C-1856] Upgrade react-native to 0.71 (#2644) Dylan Jeffers
[e863756] [C-1931] Refactor collection header for private track logic (#2676) Dylan Jeffers
[1f8358b] [C-2171] Fix remove download performance (#2903) Dylan Jeffers
[4050a55] [C-2042] Fix empty collection on deep link (#2914) Sebastian Klingler
[03a31ee] [C-2164] add retry and requeue logic to download track jobs (#2899) Andrew Mendelsohn
[3bf27f7] [C-2186] Fix spacing for longs handles/names (#2908) Raymond Jacobson
[a89b3bb] Fix image loading issues w Share to X (#2909) nicoback2
[902159c] [C-2130] Fix race cond in lineup init (#2905) Raymond Jacobson
[7beb57d] [C-2200] Fix profile tabs loading/empty states (#2906) Dylan Jeffers
[6beaa2d] [C-2198] Fix runtime error due to missing drawer data (#2904) Dylan Jeffers
[2b44b26] [C-2197] Fix image prefetch to work with fast-image (#2902) Dylan Jeffers
[5a8069f] Permission copy change (#2901) nicoback2
[d427d3e] Fix TikTok share permission for iOS (#2897) nicoback2
[44c665d] [C-2195] Fix tiktok share on android (#2900) Sebastian Klingler
[0235af9] [C-2178] Complete w/ tiktok qa fixes (#2896) Sebastian Klingler
[dfe4622] Add repost of a repost metadata to reposting tracks and collections (#2847) sabrina-kiam
[c2f6ad7] Minor updates to mobile chats (#2891) Reed
[0e70d27] [C-2169] Fix track-player hot reload (#2890) Dylan Jeffers
[a07ce78] Rename TikTok video feature flag (#2894) nicoback2
[3da2b87] Relay to both POA and ACDC (#2895) Isaac Solo
[a02fee7] [C-2176] TikTok sdk improvements (#2892) Sebastian Klingler
@AudiusProject AudiusProject deleted a comment from linear Bot Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants