Giter Club home page Giter Club logo

Comments (4)

Cafe137 avatar Cafe137 commented on May 31, 2024

Some early findings: onUploadProgress works only in the browser, and progress-stream gives inaccurate results since axios reads from it faster than it actually sends over the network.

from swarm-cli.

Cafe137 avatar Cafe137 commented on May 31, 2024

Progress-Stream Test Results

Tested with a 160MB binary.

Axios consumed the stream within 722 ms (and in 7 parts).

Actual upload took 134,429 ms.

Looks like there is no easy way around this with Axios.

As an alternative enhancement I suggest using a simple spinner, and displaying the file size beforehand. Maybe also a broad estimation, eg. <10MB: a few seconds, <100MB a few minutes.

Monkey patching Axios could still be an option, but that sounds like going down a rabbit hole.

Details:

Progress event after 106 ms
{
  percentage: 8.6328125,
  transferred: 14483456,
  length: 167772160,
  remaining: 153288704,
  eta: 11,
  runtime: 0,
  delta: 14483456,
  speed: 14483456
}
Progress event after 239 ms
{
  percentage: 13.789062499999998,
  transferred: 23134208,
  length: 167772160,
  remaining: 144637952,
  eta: 6,
  runtime: 0,
  delta: 8650752,
  speed: 23134208
}
Progress event after 339 ms
{
  percentage: 27.578124999999996,
  transferred: 46268416,
  length: 167772160,
  remaining: 121503744,
  eta: 3,
  runtime: 0,
  delta: 23134208,
  speed: 46268416
}
Progress event after 439 ms
{
  percentage: 49.453125,
  transferred: 82968576,
  length: 167772160,
  remaining: 84803584,
  eta: 1,
  runtime: 0,
  delta: 36700160,
  speed: 82968576
}
Progress event after 539 ms
{
  percentage: 67.5390625,
  transferred: 113311744,
  length: 167772160,
  remaining: 54460416,
  eta: 0,
  runtime: 0,
  delta: 30343168,
  speed: 113311744
}
Progress event after 639 ms
{
  percentage: 86.328125,
  transferred: 144834560,
  length: 167772160,
  remaining: 22937600,
  eta: 0,
  runtime: 0,
  delta: 31522816,
  speed: 144834560
}
Progress event after 722 ms
{
  percentage: 100,
  transferred: 167772160,
  length: 167772160,
  remaining: 0,
  eta: 0,
  runtime: 0,
  delta: 22937600,
  speed: 134217728
}
Uploaded in 134429 ms

from swarm-cli.

vojtechsimetka avatar vojtechsimetka commented on May 31, 2024

Interesting. I seem to remember similar issues. My gut feeling is telling me we are doing something wrong (either on the JS or on the GO side), surely if Axios could not handle the upload progress correctly somebody would notice and fix it.

Out of curiosity did you try some other library like ky to see if the upload progress works there?

from swarm-cli.

Cafe137 avatar Cafe137 commented on May 31, 2024

Cannot be implemented with axios. We added a spinner for intermediate resolution.

from swarm-cli.

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.