Реализовать ЛР 7 на оценку 3
This commit is contained in:
+5
-2
@@ -23,7 +23,7 @@ from ..observability import get_metrics
|
||||
from ..observability.logging import safe_extra
|
||||
from ..observability.propagation import extract_trace_context
|
||||
from ..repositories import JobRepository
|
||||
from .broker import connect, topology
|
||||
from .broker import MAIN_QUEUE, connect, topology
|
||||
from .pipeline import GeneratedVariant, PermanentImageError, process_image
|
||||
from .runtime import configure_logging, dependencies
|
||||
|
||||
@@ -364,7 +364,10 @@ async def run() -> None:
|
||||
try:
|
||||
channel = await connection.channel()
|
||||
await channel.set_qos(prefetch_count=settings.worker_prefetch)
|
||||
_exchange, queue = await topology(channel)
|
||||
if os.getenv('BAO_ADDR'):
|
||||
queue = await channel.declare_queue(MAIN_QUEUE, passive=True)
|
||||
else:
|
||||
_exchange, queue = await topology(channel)
|
||||
await queue.consume(worker.handle, no_ack=False)
|
||||
logger.info(
|
||||
'worker started id=%s concurrency=%d prefetch=%d',
|
||||
|
||||
Reference in New Issue
Block a user