Skip to content

Commit d2e2423

Browse files
committed
Server Worker abstract base class
1 parent 4f2d1d4 commit d2e2423

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plain/plain/server/workers/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import sys
1313
import time
1414
import traceback
15+
from abc import ABC, abstractmethod
1516
from datetime import datetime
1617
from random import randint
1718
from ssl import SSLError
@@ -48,7 +49,7 @@
4849
MAX_REQUESTS_JITTER = 50
4950

5051

51-
class Worker:
52+
class Worker(ABC):
5253
SIGNALS = [
5354
getattr(signal, f"SIG{x}")
5455
for x in ("ABRT HUP QUIT INT TERM USR1 USR2 WINCH CHLD".split())
@@ -105,13 +106,14 @@ def notify(self) -> None:
105106
"""
106107
self.tmp.notify()
107108

109+
@abstractmethod
108110
def run(self) -> None:
109111
"""\
110112
This is the mainloop of a worker process. You should override
111113
this method in a subclass to provide the intended behaviour
112114
for your particular evil schemes.
113115
"""
114-
raise NotImplementedError()
116+
...
115117

116118
def init_process(self) -> None:
117119
"""\

0 commit comments

Comments
 (0)