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.

Option to empty the queue?

See original GitHub issue

Hi and thanks for this awesome library.

I was wonder if I can empty this._queue somehow. In my app I manage a queue of actions, but sometimes I just want to empty it all out when a drastic event happens (and the old queue is not relevant anymore).


Issue Analytics

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

github_iconTop GitHub Comments

DirtyHairycommented, Feb 5, 2021

I have released version 0.3.0 on NPM. This now includes a cancel() method on mutexes and semaphores that will reject all pending locks. The currently held lock is not affected, though, so the mutex will still be locked until the current lock is released.

DirtyHairycommented, Feb 3, 2021

So the perfect solution for me is to kill the task that currently owns the lock, too. I was thinking about throwing an exception in this case.

But that’s not possible. Once a “task” has acquired the mutex, there’s no way to stop it — what we just called a “task” is really just a sequence of async execution steps that are scheduled on the event loop (and that hopefully do release the mutex eventually). There is no further interaction with the mutex before it is released in which we could throw.

I think the only thing possible is to reject the promises for all pending locks, and to wait until the current holder of the mutex releases it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I clear the std::queue efficiently? - c++ - Stack Overflow
In one scenario, I want to clear the queue in one shot( delete all jobs from the queue). I don't see any clear...
Read more >
empty() and queue::size() in C++ STL - GeeksforGeeks
Application : Given a queue of integers, find the sum of the all the integers. ... Algorithm 1. Check if the queue is...
Read more >
How to Clear Your Spotify Queue - Alphr
Here's how you can clear the Spotify queue using Windows and Mac: Open the Spotify app. Click on the Queue button located in...
Read more >
How to empty a queue with 200+ messages?
Hi all, We are using Solace in combination with Boomi. We're looking for a solution to empty a queue quickly. No matter how...
Read more >
How do I purge a queue - ActiveMQ
Another option is to use JMX to browse the queues and call the purge() method on the QueueViewMBean. You could also delete the...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found