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

Treat HTTP 202 as a failure and retry #645

Closed
priyajeet opened this issue Jan 4, 2017 · 4 comments
Closed

Treat HTTP 202 as a failure and retry #645

priyajeet opened this issue Jan 4, 2017 · 4 comments
Assignees
Labels
flag: good first issue This might be a relatively easy issue; good for new contributors status: archived Archived and locked; will not be updated type: enhancement New feature or request
Milestone

Comments

@priyajeet
Copy link

if (target.status >= 200 && target.status <= 299) {
        // All 2xx HTTP codes are success cases.
        ...
}

https://github.com/google/shaka-player/blob/18da8e04dc629ef059ec157587c21d21ce122103/lib/net/http_plugin.js#L47

Currently the player assumes that everything 2xx is a success. However 202 is generally used when the server hasn't finished processing and wants the client to try again later. From the documentation:

The request has been accepted for processing, but the processing has not been completed.

Should that if condition above be changed to filter 202? Or some new configuration parameter added such that clients can choose what constitutes a success.

@joeyparrish joeyparrish added the type: question A question from the community label Jan 4, 2017
@joeyparrish
Copy link
Member

Good question. I've never seen a 202 in the wild.

What should the behavior be? Fail and retry?

Can you give an example of when a 202 response might occur in a streaming media scenario?

@priyajeet
Copy link
Author

priyajeet commented Jan 4, 2017

Our rest endpoint for serving a dash segment (or any content type for that matter) returns a 202 to tell the client that the requested representation is still being processed. Search for 202 here https://docs.box.com/reference#download-a-file

In our use case (Box), a user uploads their media file and then clicks the file right after upload. At this point some segments may have been converted, while others are still being processed. We start the video stream as soon as the MPD file is ready + moov atom segments are ready (1st two segments typically). At this point, making a request to a non-converted future segment will return a 202. Ideally this should be considered not a success (similar to 404) and the client should just retry with some backOffFactor.

I am not sure if there are other people with similar examples. Currently we modified the shaka player (v1) locally to add special case for 202. So just wondering if something can be implemented at the shaka player level to prevent a local modification on our end. Thanks.

http://stackoverflow.com/questions/9794696/how-do-i-choose-a-http-status-code-in-rest-api-for-not-ready-yet-try-again-lat

@joeyparrish
Copy link
Member

Yes, that sounds reasonable. I'll add an exception for HTTP 202.

@joeyparrish joeyparrish added type: enhancement New feature or request and removed type: question A question from the community labels Jan 4, 2017
@joeyparrish joeyparrish added this to the v2.1.0 milestone Jan 4, 2017
@joeyparrish joeyparrish assigned joeyparrish and theodab and unassigned joeyparrish Jan 4, 2017
@joeyparrish joeyparrish added the flag: good first issue This might be a relatively easy issue; good for new contributors label Jan 4, 2017
@joeyparrish joeyparrish changed the title Should 202 be considered not a success when requesting dash segments Treat HTTP 202 as a failure and retry Jan 4, 2017
joeyparrish pushed a commit that referenced this issue Jan 7, 2017
Closes #645

Change-Id: Ie20d1de1e8eff30d7656886e2b85d0e39079774a
@joeyparrish
Copy link
Member

joeyparrish commented Jan 9, 2017

The fix for this has just been released in v2.0.3.

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
flag: good first issue This might be a relatively easy issue; good for new contributors status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants