GithubHelp home page GithubHelp logo

Progress is unreliable about gtm-session-fetcher HOT 3 OPEN

google avatar google commented on May 10, 2024
Progress is unreliable

from gtm-session-fetcher.

Comments (3)

mwyman avatar mwyman commented on May 10, 2024 1

downloadedLength not being updated is likely just an oversight. No clear reason to me why it's not being updated.

from gtm-session-fetcher.

mwyman avatar mwyman commented on May 10, 2024

It sounds like you're setting the destinationFileURL.

In that case, we're not updating downloadedLength like we do with data tasks (no destination file URL), however you can provide a download progress block and receive the current status as it updates.

For totalBytesExpectedToWrite, all network clients are at the mercy of the server sending the Content-Length header, which I believe Google Drive does not send when responding to an HTTP GET request. To show a useful progress indicator, in the past I've needed to get the file size from elsewhere (e.g. making a HEAD request before starting the fetch).

With destinationFileURL set, the completion handler's NSData will be intentionally nil. All data is written directly to the file as it's received and not retained in memory. This is useful for large files, files not intended to be used immediately, etc. So the fetcher does not re-load the bytes into memory on completion, avoiding file I/O and memory allocation that are potentially unneeded.

from gtm-session-fetcher.

matt-curtis avatar matt-curtis commented on May 10, 2024

That's pretty much what I guessed, though I don't understand why setting downloadedLength should differ between data and destination tasks, it's useful in both cases?

from gtm-session-fetcher.

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.