Repository navigation
fix: use scard for event count, index webhooks by event, longer 401 cooldown, verify cancelRetry - #396
Merged
ritaifeoluwa merged 1 commit intoSep 25, 2026
Conversation
…ooldown, verify cancelRetry - SmartDropLabs#368: Replace smembers with scard in getEventCount to avoid loading all event IDs into memory for a simple count. - SmartDropLabs#369: Add per-event-type index sets (webhooks:event:{type}) so listActiveForEvent fetches only relevant webhook IDs from Redis instead of loading every webhook record and filtering in JS. - SmartDropLabs#370: Use 10x longer circuit breaker cooldown for 401 auth failures vs transient errors — a bad API key won't self-heal, so hammering wastes quota. The open() method now accepts an optional cooldownMs override. - SmartDropLabs#371: Verify delivery exists in cancelRetry before attempting zrem, returning a structured result indicating whether the removal succeeded. Closes SmartDropLabs#368 Closes SmartDropLabs#369 Closes SmartDropLabs#370 Closes SmartDropLabs#371
|
@ogundelevictory Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Fix two performance issues and two bugs in a single PR:
smembers(loads all event IDs into memory) withscard(returns set size in O(1)) ineventStore.getEventCount.webhooks:event:{type}) solistActiveForEventfetches only webhook IDs subscribed to the specific event from Redis, instead of loading every webhook record and filtering in JavaScript. Indexes are maintained on create/update/remove.circuitBreaker.open()to accept an optionalcooldownMsoverride. CoinGecko now uses 10x the default cooldown for 401 auth failures, since a bad API key won't self-heal on retry and hammering wastes quota.deliveryRepository.cancelRetrynow verifies the delivery exists before attempting removal, returning a structured result ({ removed, reason }) so callers know whether the ID was valid and whether it was actually in the retry queue.Why
smemberson a large set causes O(n) memory allocation just to count elements;scardis O(1).How to test
getEventCount()should return the same value as before but with significantly less Redis memory usage on large event sets.cancelRetrywith a non-existent delivery ID — should return{ removed: false, reason: 'delivery not found' }.Linked issues
Closes #368
Closes #369
Closes #370
Closes #371