Initial support for a trollbox

This commit is contained in:
dsc 2022-03-14 11:41:02 +02:00
parent e79059820f
commit 0619522bb1
6 changed files with 104 additions and 12 deletions

View file

@ -39,7 +39,7 @@ class WowletTask:
self._running = False
async def start(self, *args, **kwargs):
from wowlet_backend.factory import app, connected_websockets
from wowlet_backend.factory import app, broadcast
if not self._active:
# invalid task
return
@ -94,11 +94,10 @@ class WowletTask:
propagate = False
if propagate:
for queue in connected_websockets:
await queue.put({
"cmd": self._websocket_cmd,
"data": result
})
await broadcast.put({
"cmd": self._websocket_cmd,
"data": result
})
# optional: cache the result
if self._cache_key and result:
@ -167,4 +166,4 @@ from wowlet_backend.tasks.rpc_nodes import RPCNodeCheckTask
from wowlet_backend.tasks.xmrig import XmrigTask
from wowlet_backend.tasks.suchwow import SuchWowTask
from wowlet_backend.tasks.wowlet import WowletReleasesTask
from wowlet_backend.tasks.forum import ForumThreadsTask
from wowlet_backend.tasks.forum import ForumThreadsTask