fix: bind worker_id inside BrozzlerWorker

This ensures the parameter remains available within a multithreaded context.
This commit is contained in:
Misty De Méo 2025-03-10 14:02:49 -07:00
parent bae29f7b9b
commit c9c9bda869
2 changed files with 6 additions and 0 deletions

View File

@ -369,6 +369,7 @@ def brozzle_page(argv=None):
metrics_port=args.metrics_port,
registry_url=args.registry_url,
env=args.env,
worker_id=args.worker_id,
)
def on_screenshot(screenshot_jpeg):
@ -701,6 +702,7 @@ def brozzler_worker(argv=None):
metrics_port=args.metrics_port,
registry_url=args.registry_url,
env=args.env,
worker_id=args.worker_id,
)
signal.signal(signal.SIGQUIT, dump_state)

View File

@ -81,6 +81,7 @@ class BrozzlerWorker:
metrics_port=0,
registry_url=None,
env=None,
worker_id=None,
):
self._frontier = frontier
self._service_registry = service_registry
@ -95,6 +96,9 @@ class BrozzlerWorker:
self._skip_visit_hashtags = skip_visit_hashtags
self._skip_youtube_dl = skip_youtube_dl
if worker_id is not None:
self.logger = self.logger.bind(worker_id=worker_id)
# We definitely shouldn't ytdlp if the optional extra is missing
try:
import yt_dlp