From 486bebaed9a4bbac053556f50528bbe63c18cc66 Mon Sep 17 00:00:00 2001 From: hkc Date: Thu, 11 Jul 2024 18:55:53 +0300 Subject: [PATCH] Smaller queue, rm unsubscribe, etc --- swarm/worker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/swarm/worker.py b/swarm/worker.py index 3b4aed0..8805dc3 100644 --- a/swarm/worker.py +++ b/swarm/worker.py @@ -27,7 +27,7 @@ class WorkerManager: self.base = "https://onemillioncheckboxes.com" self.delay = 0.25 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.workers: set[tuple[int, int]] = set() @@ -73,7 +73,7 @@ class WorkerManager: cookie = bot_index, self._restarts[bot_index] self.workers.add(cookie) - await sio.emit("unsubscribe") + # await sio.emit("unsubscribe") try: batch = 0 @@ -86,6 +86,7 @@ class WorkerManager: self.shmem.buf[OFFSET_STATE + byte] & mask ): await sio.emit("toggle_bit", {"index": index}) + self.shmem.buf[OFFSET_STATE + byte] ^= mask self.n_toggles += 1 self.queue.task_done() batch += 1