Compare commits
2 Commits
ideas
...
9abfbef871
| Author | SHA1 | Date | |
|---|---|---|---|
| 9abfbef871 | |||
| e2c050515d |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -22,6 +22,9 @@ from adapters.s3_adapter import S3Adapter
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# Limit concurrent generations to 4
|
||||||
|
generation_semaphore = asyncio.Semaphore(4)
|
||||||
|
|
||||||
|
|
||||||
# --- Вспомогательная функция генерации ---
|
# --- Вспомогательная функция генерации ---
|
||||||
async def generate_image_task(
|
async def generate_image_task(
|
||||||
@@ -144,8 +147,10 @@ class GenerationService:
|
|||||||
generation_model.id = gen_id
|
generation_model.id = gen_id
|
||||||
|
|
||||||
async def runner(gen):
|
async def runner(gen):
|
||||||
logger.info(f"Starting background generation task for ID: {gen.id}")
|
logger.info(f"Generation {gen.id} entered queue (waiting for slot)...")
|
||||||
try:
|
try:
|
||||||
|
async with generation_semaphore:
|
||||||
|
logger.info(f"Starting background generation task for ID: {gen.id}")
|
||||||
await self.create_generation(gen)
|
await self.create_generation(gen)
|
||||||
logger.info(f"Background generation task finished for ID: {gen.id}")
|
logger.info(f"Background generation task finished for ID: {gen.id}")
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user