Skip to content

Conversation

rotarur
Copy link

@rotarur rotarur commented Aug 23, 2025

evaluateDeployments function with batching support

  • Implement O(1) rule lookups using Map instead of linear scans
  • Add deployment filtering by minimum stake/signal thresholds
  • Process deployments in configurable batches with setImmediate yielding
  • Extract evaluateDeploymentByRules for code reuse
  • Add performance logging and metrics
  • Update ActivationCriteria enum with INVALID_DECISION_BASIS
  • Make reconciliation loop async to handle new evaluateDeployments
  • Add environment variables for batch size and stake threshold configuration

This addresses the O(N×M) performance bottleneck that caused the indexer
to hang when processing large numbers of deployments and rules.
Performance improvements scale from O(N×M) to O(N+M) complexity.

Fixes: Backend hanging at "Finished fetching subgraph deployments

@github-project-automation github-project-automation bot moved this to 🗃️ Inbox in Indexer Aug 23, 2025
- Add --indexer-min-stake-threshold CLI option to indexer-agent start command
- Integrate CLI flag with existing INDEXER_MIN_STAKE_THRESHOLD env var
- Update evaluateDeployments function to accept optional threshold parameter
- Pass threshold value through agent configuration to deployment evaluation
- Add comprehensive documentation in README including performance optimization section
- Maintain backward compatibility with environment variable fallback

This allows users to configure the minimum stake threshold for deployment
filtering via CLI, improving the performance optimization feature usability
without requiring environment variable changes.
… evaluation

- Add batching and filtering to deployment evaluation for O(N×M) to O(N+M) complexity reduction
- Implement --indexer-min-stake-threshold CLI flag for configurable stake filtering
- Add async evaluateDeployments function with configurable batch sizes
- Use Map-based rule lookups instead of linear scans for O(1) access
- Filter deployments by minimum stake/signal thresholds before processing
- Extract reusable evaluation logic into evaluateDeploymentByRules function
- Add comprehensive performance logging and metrics
- Update Agent class to support threshold configuration
- Maintain backward compatibility with environment variables
- Update Dockerfile.dev to ensure proper dependency resolution
- Add comprehensive README documentation for performance features

This addresses the performance bottleneck that caused indexer to hang
when processing large numbers of deployments (15K+) and rules.
- Add comprehensive DEVELOPMENT.md with local development and testing guide
- Move detailed development documentation from README.md to DEVELOPMENT.md
- Add reference to DEVELOPMENT.md in main README.md
- Include Dockerfile.dev usage, testing workflows, and troubleshooting
- Maintain clean separation between user and developer documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🗃️ Inbox
Development

Successfully merging this pull request may close these issues.

2 participants