Skip to content

Conversation

@smoreinis
Copy link
Collaborator

Summary

Improve concurrency by parallelizing independent async operations using asyncio.gather():

  • agents_use_case.py: Run deployment history and healthcheck workflow in parallel during agent registration (~50% faster registration)
  • task_message_service.py: Parallelize batch message operations
    • update_messages(): O(2N) sequential → O(2) parallel batches
    • delete_messages(): O(N) sequential → O(1) parallel validation

Changes

File Before After
agents_use_case.py:122-126 Sequential await for deployment history + healthcheck Parallel with asyncio.gather()
task_message_service.py:206-228 Loop with sequential get + update Parallel fetch, then parallel update
task_message_service.py:263-276 Loop with sequential get for validation Parallel fetch for validation

Test plan

  • All 184 unit tests pass
  • Ruff linting passes
  • Integration tests

Improve concurrency by parallelizing independent async operations:

- agents_use_case.py: Run deployment history and healthcheck
  workflow in parallel during agent registration (~50% faster)

- task_message_service.py: Parallelize batch message operations
  - update_messages(): O(2N) sequential → O(2) parallel batches
  - delete_messages(): O(N) sequential → O(1) parallel validation

These changes reduce latency for batch operations by running
independent database calls concurrently instead of sequentially.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants