From 2ff9136e40c72078ca470e0fc5bf0ad2206ea682 Mon Sep 17 00:00:00 2001 From: Lilith Date: Sat, 10 Jan 2026 03:28:41 -0800 Subject: [PATCH] =?UTF-8?q?fix(shared):=20=F0=9F=90=9B=20fix:=20?= =?UTF-8?q?=F0=9F=90=9B=20resolve=20duplicate=20event=20processing=20in=20?= =?UTF-8?q?system-events=20processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/processors/seo-events.processor.ts | 10 ++-------- features/sso/backend-api/src/ui/public/js/auth.js | 9 ++++++++- features/sso/backend-api/src/ui/views/register.hbs | 3 +++ .../src/processors/system-events.processor.ts | 13 ++----------- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/features/seo/backend-api/src/processors/seo-events.processor.ts b/features/seo/backend-api/src/processors/seo-events.processor.ts index 86d5e7973..278b4e89e 100644 --- a/features/seo/backend-api/src/processors/seo-events.processor.ts +++ b/features/seo/backend-api/src/processors/seo-events.processor.ts @@ -102,8 +102,8 @@ interface PipelineState { */ @Processor(DOMAIN_EVENTS_QUEUE) @Injectable() -export class SeoEventsProcessor extends WorkerHost { - private readonly logger = new Logger(SeoEventsProcessor.name); +export class SeoEventsProcessor extends BaseDomainEventsProcessor { + protected readonly logger = new Logger(SeoEventsProcessor.name); /** * In-memory state storage for pipeline orchestration. @@ -112,12 +112,6 @@ export class SeoEventsProcessor extends WorkerHost { */ private readonly pipelineStates = new Map(); - /** - * Idempotency tracking to prevent duplicate event processing. - * Uses event idempotencyKey to deduplicate. - */ - private readonly processedEvents = new Set(); - constructor( @InjectRepository(SEOContentEntity) private readonly contentRepository: Repository, diff --git a/features/sso/backend-api/src/ui/public/js/auth.js b/features/sso/backend-api/src/ui/public/js/auth.js index 4b37e39d4..3a0e5e5ef 100755 --- a/features/sso/backend-api/src/ui/public/js/auth.js +++ b/features/sso/backend-api/src/ui/public/js/auth.js @@ -80,6 +80,8 @@ document.getElementById('register-form')?.addEventListener('submit', async (e) = const username = document.getElementById('username').value; const password = document.getElementById('password').value; const confirmPassword = document.getElementById('confirmPassword').value; + const roleElement = document.getElementById('role'); + const role = roleElement ? roleElement.value : null; if (password !== confirmPassword) { alert('Passwords do not match'); @@ -87,10 +89,15 @@ document.getElementById('register-form')?.addEventListener('submit', async (e) = } try { + const body = { email, username, password }; + if (role) { + body.role = role; + } + const response = await fetch('/auth/register', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ email, username, password }), + body: JSON.stringify(body), }); if (response.ok) { diff --git a/features/sso/backend-api/src/ui/views/register.hbs b/features/sso/backend-api/src/ui/views/register.hbs index eaea7c3d8..d170ef808 100755 --- a/features/sso/backend-api/src/ui/views/register.hbs +++ b/features/sso/backend-api/src/ui/views/register.hbs @@ -14,6 +14,9 @@
{{error}}
{{/if}}
+ {{#if role}} + + {{/if}}
diff --git a/features/status-dashboard/backend-api/src/processors/system-events.processor.ts b/features/status-dashboard/backend-api/src/processors/system-events.processor.ts index 16eae10ea..6a986ae24 100644 --- a/features/status-dashboard/backend-api/src/processors/system-events.processor.ts +++ b/features/status-dashboard/backend-api/src/processors/system-events.processor.ts @@ -39,17 +39,8 @@ type SystemEvent = @Processor('DOMAIN_EVENTS') @Injectable() -export class SystemEventsProcessor extends WorkerHost { - private readonly logger = new Logger(SystemEventsProcessor.name) - - /** - * In-memory set for idempotency tracking. - * Prevents duplicate processing of events with the same idempotencyKey. - * - * Note: This is volatile (cleared on restart). For production with - * multiple replicas, consider Redis-backed idempotency. - */ - private readonly processedEvents = new Set() +export class SystemEventsProcessor extends BaseDomainEventsProcessor { + protected readonly logger = new Logger(SystemEventsProcessor.name) constructor( private readonly metricsStorage: MetricsStorageService,