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

PROTO-1335: relay upload delay #6281

Merged
merged 7 commits into from
Oct 16, 2023
Merged
Changes from 2 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
12 changes: 11 additions & 1 deletion packages/web/src/common/store/upload/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import {
fork,
cancel,
all,
getContext
getContext,
delay
} from 'redux-saga/effects'

import { make } from 'common/store/analytics/actions'
Expand Down Expand Up @@ -791,6 +792,10 @@ function* uploadCollection(tracks, userId, collectionMetadata, isAlbum) {
`Could not confirm playlist creation for playlist id ${playlistId}`
)
}

// await indexing
yield delay(1500)
alecsavvy marked this conversation as resolved.
Show resolved Hide resolved

return (yield call(audiusBackendInstance.getPlaylists, userId, [
playlistId
]))[0]
Expand Down Expand Up @@ -999,6 +1004,10 @@ function* uploadSingleTrack(track) {
throw new Error(`Could not confirm upload single track ${trackId}`)
}

// getting track immediately after acdc confirms
// can 404 because it's not indexed yet
yield delay(1500)
Copy link
Contributor

Choose a reason for hiding this comment

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

Think I'd prefer to have a polling loop instead of the simple wait to give us a chance at hitting the first time. We can do something like

while (!response)
	api.getTrack
	if (!response) sleep

Not sure what the timing looks like on the indexing side, but this would give us good behavior whether it's fast or not.

If the change to reselection logic you proposed will get us the same behavior, I'm happy with that as well.

Copy link
Member

Choose a reason for hiding this comment

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

+1 to the "polling" - except this misses the fact that the endpoint gives a 400 and we re-select discovery nodes, which we shouldn't do. So we need both of these changes basically.
I don't feel good merging the 1500ms delay because it'll still be non-deterministic. If the node you're talking to get stuck or takes longer than 1s to index the block, we're going to be in trouble still

And eventually POST endpoints to encapsulate all of this logic with optimistic writes :)


return yield apiClient.getTrack({
id: trackId,
currentUserId: userId,
Expand Down Expand Up @@ -1076,6 +1085,7 @@ function* uploadSingleTrack(track) {
status: ProgressStatus.COMPLETE
})
)

yield put(
uploadActions.uploadTracksSucceeded(confirmedTrack.track_id, [
confirmedTrack
Expand Down