Giter Club home page Giter Club logo

Comments (8)

nuvan avatar nuvan commented on August 27, 2024

Meanwhile I've looked at the code and added this around line 1140-1154 to test the behaviour and it seems to solve the issue. Now if I receive a 409 (conflict) flow stops the upload process and marks it as an error.

this.testHandler = function(event) {
  var status = $.status();
  if (status === 'success') {
    $.tested = true;
    $.fileObj.chunkEvent(status, $.message());
    $.flowObj.uploadNextChunk();
  } else if (status === 'error') {
    console.log("Irrecoverable error");
    $.fileObj.chunkEvent(status, $.message());
  } else if (!$.fileObj.paused) {// Error might be caused by file pause method
    $.tested = true;
    $.send();
  }
};

(I've closed the issue by mistake)

from flow.js.

AidasK avatar AidasK commented on August 27, 2024

File testing does not support permanent error handling at the moment and this should be implemented.
Your code causes to fail one test case (File testing feature is not working anymore). If you could fix this, please make a pull request.

Line which is causing problems:
https://github.com/flowjs/flow.js/blob/master/src/flow.js#L1309
maxChunkRetries by default is set to 0 and this statement is always true then file is being tested.

from flow.js.

nuvan avatar nuvan commented on August 27, 2024

Thanks for the reply @AidasK . I'll give it a stab this weekend.

from flow.js.

AidasK avatar AidasK commented on August 27, 2024

Should be fixed with c2080ef
Please test it, will be released once tested in a production.

from flow.js.

adiroiban avatar adiroiban commented on August 27, 2024

Would be nice to also update the documentation/README to describe how this can be done. Thanks!

from flow.js.

adiroiban avatar adiroiban commented on August 27, 2024

Do you/we want to abort on any errors?

For example 503 Service Unavailable is a transient server error and for this kind of error we would like to flow.js client to retry the test.

From this point of view, it would be nice if flow.js would allow configuring a list of error codes which has the semantic of "reject".

I would say that we would need a list of rejectErrorCode = [409] and stop testing only if this specific error code is returned... for all other errors, retry.

Thanks!

from flow.js.

AidasK avatar AidasK commented on August 27, 2024

We have such an option, it is called permanentErrors https://github.com/flowjs/flow.js#configuration.

Unfortunately, request retry works only for upload requests. How file testing works:

  1. We send GET(by default) request to the server with chunk params
  2. Server checks and validates the file:
  • if file is invalid, server returns error code, which is in permanentErrors list, file upload stops.
  • if file is valid and file chunk exists on the server side, server returns status from successStatuses list. Client moves to the next chunk test/upload.
  • if file is valid and file chunk does not exists on the server side, server returns any status, which is not in the permanentErrors and successStatuses lists. Client uploads the chunk.

In order to support retry feature for file testing, we need a separate status list, such as chunkNotFoundStatuses. If response status is not in this array, then retry.

from flow.js.

adiroiban avatar adiroiban commented on August 27, 2024

Many thanks! I think that copying your comment in the documentation would be a great improvement to the documentation :)

from flow.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.