Comments (19)
Just released 1.4.0
with retry count! Closing this issue.
Let me know if you have anymore questions or suggestions!
from tuskit.
@Acconut Yes! This adds a retry count parameter to the method, in the form suggested by @MohammadrezaZamanieh.
TUSResumableUpload *upload = [self.tusSession createUploadFromFile:fileUrl retry:3 headers:@{} metadata:@{}];
from tuskit.
Hey @moonsoo there is no method as of yet, but I can look into the android client to see what is happening and recreate it.
Can you please describe your scenario so I can recreate it?
Thanks!
from tuskit.
my scenarios are:
-
case 1
retry upload infinitely when i received network failure.
(it occurs when i set airplane mode) -
case 2
retry upload infinitely when i received http response error.
(it occurs when i set one of tus metadata's value to empty string. for instance key is "event_code" and value is "")
i thought: (if i can set retry count to 5)
- case 1 upload fails when i receive network failure over 5 times.
- case 2 upload fails when i receive response error over 5 times.
thanks for your fast feedback
from tuskit.
Could this be related to #27 as both seem to retry forever?
from tuskit.
@Acconut
i think this could be related to #27 as a sub issue.
if i can set retry count, endless loop could be disappear. then my issues will be gone.
from tuskit.
failure block not called when im getting 405 HTTP status code and TUS running on infinite loop for trying again
TUSResumableUpload.m:(372) Server responded to create file with 405. Trying again
i think TUResumableUpload creatUpload method should have 2 other flags :
1- shouldRetry:Bool
2-retryCount:Int
from tuskit.
@MohammadrezaZamanieh Your problem is not related to the issue described by @moonsoo. The "405 Method Not Allowed" error means that you are using the wrong URL endpoint. Please ensure that you are passing the correct file creation URL to TUSKit. If your problem persist, please open a new ticket.
from tuskit.
@MohammadrezaZamanieh
I still see value in adding these two flags and I'll bump it in the list of priority.
The proposed changes would deprecate the following method
TUSResumableUpload *upload = [self.tusSession createUploadFromFile:fileUrl headers:@{} metadata:@{}];
And introduce these two as a replacement
TUSResumableUpload *upload = [self.tusSession createUploadFromFile:fileUrl headers:@{} metadata:@{} retry:NO];
NO
would only try the upload once
YES
would try endlessly
TUSResumableUpload *upload = [self.tusSession createUploadFromFile:fileUrl headers:@{} metadata:@{} retryCount:3];
The upload will only try 3 times before failing out.
Does this sound like it would work best or do you have any suggestions how you'd like to see this introduced?
from tuskit.
@MMasterson You're right, these options are still useful. How do you plan on implementing them? Are the retries attempted immediately after each other or is there a delay between them (or maybe even some exponential backoff mechanism)?
from tuskit.
@Acconut - Thinking about it more, I believe the API for the android SDK and TUSKit should be similar. Looking at the Android SDK, and correct me if I'm wrong, but if an upload fails it just returns a new upload object, allowing a retry up to whatever parameters the developer sets.
That implementation would update the failure block as such
static TUSUploadFailureBlock failureBlock = ^(TUSResumableUpload* upload, NSError* error){
// Should we try again?
[upload resume];
// Handle the error
NSLog(@"error: %@", error);
};
from tuskit.
if an upload fails it just returns a new upload
You are mostly right but the tus-java-client doesn't return a new upload. Instead, you have to manually query for a new upload. That's what following line in the example (https://github.com/tus/tus-java-client/#usage) is doing:
TusUploader uploader = client.resumeOrCreateUpload(upload);
from tuskit.
@Acconut that's where the API differs a bit, but it is still the most equivalent practice. I think its the best approach, I'll begin working on it
from tuskit.
Sure, if you think this approach fits TUSKit better then please go ahead 👍
from tuskit.
@MMasterson
i think the new method with "retryCount" will be enough and there is no need to method with "retry:NO" because when the retry is NO that means "retryCount:1" and when "retry:YES" that means infinite retries that can be handled with "retryCount:1000" or something like this
@Acconut
i think it would be better if errors like 405 and other failure http Status codes handle in "Failure Block"
from tuskit.
@MohammadrezaZamanieh i think it would be better if errors like 405 and other failure http Status codes handle in "Failure Block"
It's hard to distinguish between errors which can and cannot be fixed by retrying. When in doubt I would prefer to retry anyways because that's not a big loss if it doesn't work. However, I agree that TUSKit should never end up in an infinite retry loop. I am not sure if that's currently the case but if so, I would like to ask @MMasterson to address this :)
from tuskit.
@Acconut @MohammadrezaZamanieh
It does end up in a loop, and it's infinite until intervention. The upload can be canceled or stopped, but the process of doing so should be updated.
Addressing it this weekend!
from tuskit.
@MMasterson Thank you, perfect!
from tuskit.
Very nice, @MMasterson! Does this also address issue were TUSKit can end up in an infinite retry loop?
It does end up in a loop, and it's infinite until intervention. The upload can be canceled or stopped, but the process of doing so should be updated.
from tuskit.
Related Issues (20)
- How to use this in kotlin multiplatform HOT 2
- SSL Pinning Task [Swift] HOT 1
- about supportedExtensions property automatic acquisition HOT 4
- Get metadata for a failed uploads HOT 4
- Can I use it in an OC project HOT 10
- Uploading stuck HOT 7
- couldNotUploadFile Error with status code 409: Upload-Offset conflict HOT 6
- POST requests include unknown `Upload-Extension` header HOT 1
- How to reconcile TUS Design with Apple Design for Background Uploads? HOT 23
- Ambiguity around the `retry(id:)` function HOT 2
- Delegate method didStartUpload not being called HOT 1
- Scheduler Crash in TUSClient.cancel(id:) HOT 5
- Is there an oc version? HOT 1
- Issue with large files couldNotUploadFile(underlyingError: TUSKit.TUSAPIError.couldNotRetrieveOffset) HOT 5
- Background upload not completing on iOS 17 until app is moved to the foreground HOT 4
- Make a new release available HOT 3
- Releases tab seems to be a bit messed up HOT 1
- ksum
- Example Project: Missing Extensions for Images and Error for File Uploads HOT 8
- TUSClientError HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tuskit.