Feat/batch operations#130
Merged
Merged
Conversation
- Add getUsersByWalletAddressesBatch method in SubscriptionService - Add findByIds and findByAddresses methods in KnexUserRepository - Add findByAddresses method in KnexUserAddressRepository - Add POST /users/by-addresses/batch endpoint in UserAddressController - Optimize database queries by batching address lookups instead of individual calls 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add getWalletOwnersBatch method for batch wallet owner lookups - Add shouldSendBatch method for batch notification deduplication - Optimize shouldSendBatch with HashMap for O(1) lookups instead of O(n²) nested loops - Update ISubscriptionClient interface with new batch method signatures 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace sequential getWalletOwners calls inside loop with single batch call - Extract unique account IDs and fetch wallet owners upfront using getWalletOwnersBatch - Improve performance from O(n) API calls to O(1) batch call for n events - Maintain same functionality while reducing network overhead and latency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add getWalletOwnersBatch mock method to SubscriptionClient test mocks - Add shouldSendBatch mock method to SubscriptionClient test mocks - Ensure test files compile with new batch method signatures - Maintain test coverage for refactored batch processing functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
9 tasks
- Change triggerHandlers to support arrays of handlers per trigger ID - Implement parallel execution of handlers using Promise.allSettled - Add result aggregation combining messageIds and using latest timestamp - Add fault-tolerant error handling that logs failures but doesn't break service - Throw error only when all handlers fail - Add comprehensive tests for multiple handler scenarios 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace multiple parallel getWalletOwners calls with single getWalletOwnersBatch call - Replace multiple shouldSend calls with single shouldSendBatch call - Reduce API requests from O(n) to O(1) for n addresses and events - Improve notification deduplication efficiency using batch operations - Maintain same notification logic while significantly reducing network overhead 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add getWalletOwnersBatch mock method to SubscriptionClient test mocks - Add shouldSendBatch mock method to SubscriptionClient test mocks - Ensure test files compile with new batch method signatures - Maintain test coverage for refactored batch processing functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
lgahdl
approved these changes
Aug 28, 2025
- Modified Consumer App constructor to accept ENS resolver as parameter - Updated index.ts to create and inject ENS resolver instance - Enables easier testing by allowing mock injection This change prepares the codebase for using mock ENS resolver in tests to avoid async operations that continue after test teardown. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Created MockEnsResolverService that returns synchronous responses - Avoids real network calls to ENS during tests - Prevents async operations from continuing after test teardown This mock resolves the issue where ENS resolution was causing "import after Jest teardown" errors in integration tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Updated startTestApps to use MockEnsResolverService - Fixed tsconfig to exclude test files from build - Ensures all integration tests use mock instead of real ENS This completes the fix for voting-power test interference issue. All tests now pass consistently without async ENS operations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Feat/non voting trigger
feat: add multiple handlers support to TriggerProcessorService
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces batch processing capabilities across the notification system to significantly improve performance by reducing N+1 query patterns and optimizing API calls.
Changes Made
🎯 Subscription Server
POST /users/by-addresses/batchfor fetching users by multiple wallet addresses in a single requestgetUsersByWalletAddressesBatch()method with optimized database queriesfindByAddresses()andfindByIds()methods for efficient batch operations🚀 Dispatcher Service
getWalletOwnersBatch()andshouldSendBatch()to SubscriptionClient🧪 Testing
Performance Impact
Before
After
Test Plan
Breaking Changes
None - all new functionality is additive and maintains backward compatibility.
Dependencies
No new external dependencies added. Uses existing infrastructure.