We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d240813 commit 521c38cCopy full SHA for 521c38c
1 file changed
app/fetch/update.py
@@ -5,7 +5,6 @@
5
import functools
6
import sys
7
import traceback
8
-from asyncio import Event
9
10
from aiolimiter import AsyncLimiter
11
@@ -26,19 +25,21 @@
26
25
27
28
@functools.cache
29
-def _get_update_event() -> Event:
30
- return Event()
+def _get_update_queue() -> asyncio.Queue[None]:
+ return asyncio.Queue(maxsize=1)
31
32
33
async def wait_for_update() -> None:
34
- update_event = _get_update_event()
35
- await update_event.wait()
36
- update_event.clear()
+ update_queue = _get_update_queue()
+ await update_queue.get()
37
38
39
def queue_update() -> None:
40
41
- update_event.set()
+ try:
+ update_queue.put_nowait(None)
+ except asyncio.QueueFull:
42
+ pass
43
44
45
async def trigger_loop() -> None:
0 commit comments