Proper way to clear event queue
See original GitHub issueIs there a proper way to flush the event queue? I have an application where I would like to “unhook” from the events while the callback is firing and then begin processing events again afterward. I tried using keyboard.unhook(callback)
before the function and then rehooking again after the function call but it seems to maintain the event queue when unhooked.
I also tried this hacky trick but it seems to (unsurprisingly) break the processing of future events.
def unhooked_event(func):
def wrapper(self, *args):
#keyboard.unhook(self.event_hook)
func(self, *args)
#keyboard.hook(self.event_hook)
while not keyboard._listener.queue.empty():
e = keyboard._listener.queue.get()
Is there some functionality available to make what I want possible?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Clean up the EventQueue and PublishQueue tables
Clean up the event queue on demand · On the Sitecore Launchpad, click Control Panel, Administration tools, and Event Queue Statistics. · In...
Read more >java swing clear the event queue - Stack Overflow
Run the SSCCE · Click on the button "Wait 3 seconds". It simulates an expensive operation. · While the cursor is busy, click...
Read more >How to flush the event queue? - Forums - IBM Support
I have an active class that consumes events in a state-chart. In some special occasions I want to flush the event queue immediately...
Read more >How to clear forwarding queue - OBM - Support
The last option is to delete the events from the forwarding queue directly from the database: Stop OBM services.
Read more >Solved: clear event structure queue - NI Community
What I would like to do is to be able to clear the user event queue so if someone push a certain button...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this issue is fairly specific to your problem, so I’m closing this issue. If you can think of a way to add functionality to
keyboard
that would be useful to other people, please don’t hesitate to reopen the issue.Yes it does fix the problem, thanks. I’ll have to see if I can tidy up the decorator now to be able to set and unset the flag on that thread.