-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
create_batch_remediation() in batch.py:25 calls PlatformService.process_batch_job() synchronously inside an async endpoint:
PlatformService.process_batch_job(job_data)This blocks the entire event loop for the duration of the batch, preventing the server from handling any other requests. For a batch of many devices, this could block for a significant time.
The docs describe batch processing as "parallel," but the implementation is sequential and blocking.
Suggested Fix
- Use
asyncio.to_thread()or FastAPI'sBackgroundTasksto run batch processing off the event loop. - Return a 202 Accepted with the job ID immediately, and let the client poll
/batch/jobs/{id}for status. - Consider
concurrent.futures.ProcessPoolExecutorfor true parallelism across devices.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working