Skip to content

Conversation

@jayadityashah
Copy link

@jayadityashah jayadityashah commented Jan 2, 2026

Description

Resolves connection errors under high concurrent load and enables safe testing with 100+ simultaneous threads.

Type of Change

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • style: Code style/formatting
  • refactor: Code refactoring
  • perf: Performance improvement
  • test: Tests added/updated
  • chore: Maintenance (dependencies, build, etc.)
  • ci: CI/CD changes

Related Issues

Not sure if there is a related issue

Changes Made

  • Add instance-level locks to prevent concurrent graph loading issues
  • Implement thread-safe lock creation with master lock pattern
  • Add double-check pattern after acquiring locks for cache consistency
  • Include proper cleanup in invalidate_cache() to prevent memory leaks
  • Use lazy initialization to avoid event loop issues during startup

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • E2E tests added/updated
  • Manual testing performed

Checklist

  • Code follows project style (Ruff formatting)
  • All linting checks pass (make lint)
  • Type checking passes (make type-check)
  • All tests pass (make test)
  • Documentation updated (if needed)
  • Commit messages follow Conventional Commits
  • PR title follows Conventional Commits format

Screenshots (if applicable)

Additional Notes

…oading

  - Add instance-level locks to prevent concurrent graph loading issues
  - Implement thread-safe lock creation with master lock pattern
  - Add double-check pattern after acquiring locks for cache consistency
  - Include proper cleanup in invalidate_cache() to prevent memory leaks
  - Use lazy initialization to avoid event loop issues during startup

  Resolves connection errors under high concurrent load and enables
  safe testing with 100+ simultaneous threads.
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/agent_server/services/langgraph_service.py 86.66% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@jayadityashah
Copy link
Author

@ibbybuilds the 4 lines above that codecov mentioned are my changes, which is why they are different I ran the tests and they worked.

Happy to change discuss more if this commit needs more work.

@jayadityashah
Copy link
Author

Does this mean that we write a test for this in the startup like the other tests? And then if the test covers this line, codecov will accept it?

@ibbybuilds
Copy link
Owner

@jayadityashah coverage above 85% is totally fine, we don't always need 100% coverage. I will review the code and ask for changes if needed, just a little busy these days

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.

3 participants