Giter Club home page Giter Club logo

Comments (4)

piotrmurach avatar piotrmurach commented on June 6, 2024

Thanks for using the gem and reporting this issue!

Great spot. Do you have time to submit PR? Even a test demonstrating the issue will be good?

from tty-progressbar.

elquimista avatar elquimista commented on June 6, 2024

Honestly I don't have time for a PR, but I'll take a look into this when I get a chance.

from tty-progressbar.

elquimista avatar elquimista commented on June 6, 2024

If I insert byebug after the 2nd register call in #fetch method, and check @multibar.total it correctly says 21 so I think this is issue with redrawing the top bar when its children are updated.

from tty-progressbar.

piotrmurach avatar piotrmurach commented on June 6, 2024

Some notes for people who may be reading this issue. The original intention behind multi progress bars was to track the execution of multiple tasks/jobs concurrently. The provided example is a synchronous set of steps that the gem hasn't been designed for. The following would work as expected when converted to separate threads of execution:

class FetchPackages
  def run
    @multibar = TTY::ProgressBar::Multi.new('Fetching packages (:current/:total)')
    th_valid = Thread.new { validate_local_cache }
    th_fetch = Thread.new { fetch }
    th_valid.join
    th_fetch.join
  end
  ...

Though this would fail in the given scenario as the fetching would happen before validation. There's a new resume api that will help stop and resume single progress bars. This call will automatically trigger when a multi-bar is in use.

from tty-progressbar.

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.