question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Great work.

I am facing some issue on nested loops.

with alive_bar(title="Fetching existing Github issues: ") as bar:
        while another_page:
            response = SESSION.get(url, params={'per_page': 100})
            if response.status_code == 200:
                for issue in response.json():
                    bar()
            if 'next' in response.links:
                url = response.links['next']['url']
            else:
                another_page = False

In this sample piece of code, bar updates after 100 items. If I have 250 items, it will update 100 > 200 > 250

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rsalmeicommented, Jan 14, 2021

In this problem of yours, you could create a deque, and let one thread fetching the issues, while the main thread receives and processes them. Only here in the main thread you would instantiate alive_bar, and would not have those “skips”.

You could even use a ThreadPool and fetch all pages in parallel, and receive the issues via the same deque, it would be much better.

0reactions
appi147commented, Jan 14, 2021

Yep. In actual code, there were lines, but I was amazed, how fast all 100 were processed.

On Thu, 14 Jan 2021, 22:16 Rogério Sampaio de Almeida, < notifications@github.com> wrote:

No problem man. A closed loop like that, with only bar() inside it, runs so wildly fast (in a few microseconds) that the bar doesn’t have any time to update itself. And this is a great feature of alive-progress!! It is not “directly connected”, there’s a calibration curve that enables you to update MILLIONS of times per second, and the bar updates itself in a fraction of that, at most 60 frames per second. More than that the human eye do not perceive any difference, and is just wasted CPU cycles. In your case you should have some work being done before calling bar() 👍

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/rsalmei/alive-progress/issues/74#issuecomment-760318831, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYBERUUV2PBYTXAG3NLO2TSZ4NWVANCNFSM4V7MOQ4A .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Avoid The 8-Bar Loop Trap - EDMProd
First, get the basic structure down by using blank MIDI clips or markers (name them: intro, verse, chorus, etc.) Then, listen to each...
Read more >
Bar Loops - Etsy
Check out our bar loops selection for the very best in unique or custom, handmade pieces from our shops.
Read more >
Methods to get out of 1-2 bar loops? : r/ableton - Reddit
I usually actually start with an 8 bar drum loop with a fill for the last bar or half bar, then repeat it...
Read more >
Stream Empty Bar music - SoundCloud
Empty Bar is a modern acoustic songs project with two people founded in 2014. We use an acoustic guitar, loop station and percussion...
Read more >
why do i keep writing 8 bar loops - oh, i see why.
... empty loops. sure i can make percussive sounds with my synths and ... Take those 8 bar loops, sample them, get an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found