Smaller queue, rm unsubscribe, etc

This commit is contained in:
Casey 2024-07-11 18:55:53 +03:00
parent 9e03a442e3
commit 486bebaed9
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 3 additions and 2 deletions

View File

@ -27,7 +27,7 @@ class WorkerManager:
self.base = "https://onemillioncheckboxes.com" self.base = "https://onemillioncheckboxes.com"
self.delay = 0.25 self.delay = 0.25
self.batch_size = 7 self.batch_size = 7
self.queue: asyncio.Queue[int] = asyncio.Queue(128) self.queue: asyncio.Queue[int] = asyncio.Queue(64)
self.n_toggles = 0 self.n_toggles = 0
self.workers: set[tuple[int, int]] = set() self.workers: set[tuple[int, int]] = set()
@ -73,7 +73,7 @@ class WorkerManager:
cookie = bot_index, self._restarts[bot_index] cookie = bot_index, self._restarts[bot_index]
self.workers.add(cookie) self.workers.add(cookie)
await sio.emit("unsubscribe") # await sio.emit("unsubscribe")
try: try:
batch = 0 batch = 0
@ -86,6 +86,7 @@ class WorkerManager:
self.shmem.buf[OFFSET_STATE + byte] & mask self.shmem.buf[OFFSET_STATE + byte] & mask
): ):
await sio.emit("toggle_bit", {"index": index}) await sio.emit("toggle_bit", {"index": index})
self.shmem.buf[OFFSET_STATE + byte] ^= mask
self.n_toggles += 1 self.n_toggles += 1
self.queue.task_done() self.queue.task_done()
batch += 1 batch += 1