-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
I have created a clear() method in a sub-class to clear a persistent queue.
Is there a better approach than getting entries in a loop?
Feature request: add a clear method upstream :)
from persistqueue import (
Queue as PersistQueue,
Empty as PersistQueueEmpty,
Full as PersistQueueFull,
)
class MyPersistQueue(PersistQueue):
"""
Customised persistqueue.Queue
"""
def clear(self) -> None:
"""
Clear all items from queue.
persistqueue.Queue does not have a native `clear()` method.
"""
while True:
try:
self.get_nowait()
except PersistQueueEmpty:
breakMetadata
Metadata
Assignees
Labels
No labels