Delete watcher.py

This commit is contained in:
akp 2022-11-08 02:26:24 +00:00
parent eab2474101
commit bd5d0f26e9
No known key found for this signature in database
GPG key ID: AA5726202C8879B7

View file

@ -1,32 +0,0 @@
from dataclasses import dataclass
import multiprocessing
import time
from typing import *
class Watcher:
_queue: multiprocessing.Array
_lock: multiprocessing.Lock
def __init__(self):
self._lock = multiprocessing.Lock()
self._queue = multiprocessing.Array(lock=False)
def start(self):
multiprocessing.Process(
target=self._worker, args=(self._queue, self._lock)
).start()
@staticmethod
def _worker(jobs: multiprocessing.Array, lock: multiprocessing.Lock):
while True:
time.sleep(60)
lock.acquire()
jobs.pop()
lock.release()
def register(self, ws: WatchState):
self._queue.append(ws)