Python Forum
Clearing an asyncio queue if it's empty
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clearing an asyncio queue if it's empty
#1
Hi all,

I was wondering if anyone would know the simplest way (I don't know any) to check if an asyncio queue is empty and how to clear it. I use this method to do the same with normal queues:

if EXAMPLE_QUEUE.empty() == False:
    with EXAMPLE_QUEUE.mutex:
        EXAMPLE_QUEUE.queue.clear()
Something similar would be nice, but I'll use any working solution ofc.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Asyncio: Queue consumer gets out of while loop without break. Where exactly and how? saavedra29 2 2,715 Feb-07-2022, 07:24 PM
Last Post: saavedra29
  task queue Valon1981 8 3,626 Jul-07-2020, 07:41 AM
Last Post: freeman
  Queue in Pygame constantin01 1 3,708 Jan-07-2020, 04:02 PM
Last Post: metulburr
  Queue maxsize mr_byte31 2 4,582 Sep-03-2019, 07:02 PM
Last Post: mr_byte31
  Clearing IDLE of text and homing Umlaut_The_Phonetic 1 2,687 Jul-07-2018, 04:31 AM
Last Post: Zombie_Programming
  Queue.Queue() would not reduce capacity after get() yuan8421 9 11,120 Jan-02-2018, 09:38 PM
Last Post: Windspar
  Threading and Queue nexusfactor 5 4,302 Oct-16-2017, 04:14 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020