feat: event-driven tenant discovery in MultiTenantConsumer#398
feat: event-driven tenant discovery in MultiTenantConsumer#398jeffersonrodrigues92 merged 1 commit intodevelopfrom
Conversation
Close() held c.mu while calling eventListener.Stop(), which waits for the listener goroutine to finish. That goroutine may be executing an event handler that acquires c.mu, causing deadlock. Fix: snapshot the listener reference under the lock, release the lock, stop the listener, then re-acquire for the rest of cleanup. X-Lerian-Ref: 0x1
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Comment |
…tenant-discovery" This reverts commit 73fa990.
Summary
tenant-events:*, lazy-load on first requestChanges
New package:
commons/tenant-manager/event/TenantLifecycleEventenvelope, 12 event type constants, 7 typed payload structsTenantEventListener— Redis Pub/Sub subscriber with graceful shutdownParseEvent(),ChannelForTenant()helpersNew components in
consumer/multi_tenant_cache.go) — 12h default, lazy eviction, thread-safemulti_tenant_lazy.go) — on-demand tenant fetch with per-tenant mutexmulti_tenant_events.go+_handlers.go) — 12 handlers with service filtering, jitter, full TenantConfig populationBreaking changes
NewMultiTenantConsumerWithError()now requiresredisClientparameterWithRedisClient()option removed (now constructor param)syncActiveTenants(),discoverTenants(), etc.multi_tenant_sync.go,multi_tenant_revalidate.goFixes (from review feedback)
modulesas[]string,secret_pathsas nested map,messaging_configwith flatrabbitmq_secret_path)handleServiceAssociated/handleServiceReactivatednow populate fullTenantConfig(ConnectionSettings, Databases, Messaging)Close()stops event listener outsidec.mulock to prevent deadlockTest plan
-racepanic()in production codeCloses #396
🤖 Generated with Claude Code