Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions listener/src/api/events-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,6 @@ export function createEventsServer(options: EventsServerOptions): http.Server {

logger.info('GET /api/notifications/history complete', {
requestId,
correlationId,
returned: result.records.length,
total: result.total,
durationMs: Date.now() - startTime,
});
Expand All @@ -486,10 +484,7 @@ export function createEventsServer(options: EventsServerOptions): http.Server {
const userId = decodeURIComponent(getPrefsMatch[1]);
logger.info('Handling GET /api/preferences/:userId', { requestId, correlationId, userId });
const prefs = preferenceStore.get(userId);
logger.info('GET /api/preferences/:userId complete', { requestId, correlationId, userId, durationMs: Date.now() - startTime });
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(prefs));
return;
}

// PUT /api/preferences/:userId
Expand Down Expand Up @@ -520,7 +515,6 @@ export function createEventsServer(options: EventsServerOptions): http.Server {
});
return;
}

logger.warn('Unhandled request', { requestId, correlationId, method: req.method, url: req.url });
res.writeHead(404, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ error: 'Not found' }));
Expand Down
6 changes: 6 additions & 0 deletions listener/src/database/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ CREATE TABLE IF NOT EXISTS scheduled_notifications (
);

-- Indexes for performance optimization
CREATE INDEX IF NOT EXISTS idx_scheduled_notifications_status
ON scheduled_notifications(status);

CREATE INDEX IF NOT EXISTS idx_scheduled_notifications_status_execute_at
ON scheduled_notifications(status, execute_at)
WHERE status = 'PENDING';
Expand Down Expand Up @@ -76,6 +79,9 @@ CREATE INDEX IF NOT EXISTS idx_execution_log_notification_id
CREATE INDEX IF NOT EXISTS idx_execution_log_execution_time
ON notification_execution_log(execution_time);

CREATE INDEX IF NOT EXISTS idx_execution_log_status_execution_time
ON notification_execution_log(status, execution_time);

-- Trigger to update updated_at timestamp
CREATE TRIGGER IF NOT EXISTS update_scheduled_notifications_timestamp
AFTER UPDATE ON scheduled_notifications
Expand Down
Loading