Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Updating bar with value > max_value #97

Copy link
Copy link

Description

@almcleanuk
Issue body actions

In applications that deal with RESTful web APIs I frequently come across situations where the code looks like the folowing.

  • API call to get number of "items" available
  • Loop over a series of API calls to get those "items" in batches

The problem is that if I use a progress bar to track progress, naïve code suffers from a race condition if the number of "things" available changes between the call to get their count and the calls to fetch them.

This results in a lot of repetitious boilerplate code along the lines:

if count <= max_value:
    bar.update(count)

It's easy to forget to include the guard, which results in annoying non-deterministic failures that are hard to catch in testing.

It would be nice if the library could (optionally) include logic to ignore updates outside the expected range.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.