21 lines
542 B
Python
21 lines
542 B
Python
import logging
|
|
# import time as sleep
|
|
|
|
from prometheus_async.aio import time
|
|
|
|
from barcode_server.barcode import BarcodeEvent
|
|
from barcode_server.notifier import BarcodeNotifier
|
|
from barcode_server.stats import FILE_NOTIFIER_TIME
|
|
|
|
LOGGER = logging.getLogger(__name__)
|
|
|
|
class FileNotifier(BarcodeNotifier):
|
|
|
|
def __init__(self, path: str):
|
|
super().__init__()
|
|
self.path = path
|
|
|
|
@time(FILE_NOTIFIER_TIME)
|
|
async def _send_event(self, event: BarcodeEvent):
|
|
LOGGER.debug(f"Notified {self.path}: {event.barcode}")
|