7 Commits
Author SHA1 Message Date
coo1estguy bcd0bb26e4 fix: handle mid-run workflow cancellation, graceful server shutdown ordering, and profile attribute merging 2026-09-30 12:22:59 +05:30
coo1estguy 7b4d7f8efd fix: restore scheduled queues from postgres and recover consumer groups after redis data loss 2026-09-29 14:33:41 +05:30
coo1estguy 35a34df2fe refactor: extract worker bootstrap runtime and remove unused code 2026-09-29 13:10:15 +05:30
coo1estguy 880fe32b03 perf: rebuild profiling harness and reduce per-message pipeline cost
- Rebuild profiling suite with compose CLI, in-network k6 load generator, and production-shaped tiers
- Add fused pipeline mode for in-memory single-user stage hand-offs
- Route directly by contact ID and defer template rendering to delivery
- Add Redis connection sharing, auto-pipelining, stream read coalescing, and chunked provider throttling
- Switch hot message_logs and delivery_outbox inserts to unnest bulk SQL queries
- Drop redundant indexes on message_logs
- Optimize worker batching, flush concurrency, and dataloader windowing
2026-09-29 00:35:01 +05:30
coo1estguy ca95c8b917 perf(rate-limiter): add sliding-window token leasing to cut redis roundtrips
- Add LUA_LEASE_API_RATE_LIMIT script and register leaseApiRateLimit custom command

- Implement ApiRateLimiter with in-memory token leasing and 5s lease target

- Coalesce concurrent requests on depleted lease to avoid thundering-herd refills

- Prefill tokens immediately on minute bucket transition

- Add unit tests covering memory caching, pre-fetching, concurrency, and fail-open
2026-09-26 23:16:19 +05:30
coo1estguy 4642308fe8 fix(delivery): enforce two-phase idempotency leases and stream retry tracking
- Add two-phase idempotency with acquireLease and markProcessed using a single-key SET NX fast path
- Return { ack: false } on lock collisions to leave messages pending in the stream instead of acknowledging them
- Bound provider dispatch timeout within the lock lease window to prevent duplicate delivery under slow responses
- Replace per-message Redis MULTI/INCR retry keys with Redis Stream PEL delivery counts
- Handle LockHeldError in BaseWorker to skip message acknowledgement when another worker holds the lock
2026-09-25 22:46:06 +05:30
coo1estguy 3be502943f perf(redis): pre-compile Lua scripts via defineCommand across services
- Register custom Lua scripts during RedisClient initialization via defineCommand
- Pre-compile checkApiRateLimit, throttleProvider, throttleUser, releaseLock, renewLock, and schedulerPoll
- Augment ioredis Redis and ChainableCommander type interfaces for custom commands
- Maintain eval fallbacks across callers for compatibility with test mocks
- Add test suite in tests/redis.test.ts verifying registration, execution, and fallbacks
2026-09-25 14:20:46 +05:30