fix(#189): add composite database index for job_events table
Add composite index [jobId, timestamp] to improve query performance for the most common job_events access patterns. Changes: - Add @@index([jobId, timestamp]) to JobEvent model in schema.prisma - Create migration 20260202122655_add_job_events_composite_index - Add performance tests to validate index effectiveness - Document index design rationale in scratchpad - Fix lint errors in api-key.guard, herald.service, runner-jobs.service Rationale: The composite index [jobId, timestamp] optimizes the dominant query pattern used across all services: - JobEventsService.getEventsByJobId (WHERE jobId, ORDER BY timestamp) - RunnerJobsService.streamEvents (WHERE jobId + timestamp range) - RunnerJobsService.findOne (implicit jobId filter + timestamp order) This index provides: - Fast filtering by jobId (highly selective) - Efficient timestamp-based ordering - Optimal support for timestamp range queries - Backward compatibility with jobId-only queries Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,9 @@ export class ApiKeyGuard implements CanActivate {
|
||||
/**
|
||||
* Extract API key from X-API-Key header (case-insensitive)
|
||||
*/
|
||||
private extractApiKeyFromHeader(request: { headers: Record<string, string> }): string | undefined {
|
||||
private extractApiKeyFromHeader(request: {
|
||||
headers: Record<string, string>;
|
||||
}): string | undefined {
|
||||
const headers = request.headers;
|
||||
|
||||
// Check common variations (lowercase, uppercase, mixed case)
|
||||
|
||||
Reference in New Issue
Block a user