* Parses the ENABLED_QUEUES environment variable and returns an array of queue names to start. * If no env var is provided, returns all queues. * * Supported queue names: * - events - All event shards (events_0, events_1, ..., events_N) * - events_N - Individual event shard (where N is 0 to EVE
()
| 54 | * - sessions, cron, notification |
| 55 | */ |
| 56 | function getEnabledQueues(): QueueName[] { |
| 57 | const enabledQueuesEnv = process.env.ENABLED_QUEUES?.trim(); |
| 58 | |
| 59 | if (!enabledQueuesEnv) { |
| 60 | logger.info( |
| 61 | { totalEventShards: EVENTS_GROUP_QUEUES_SHARDS }, |
| 62 | 'No ENABLED_QUEUES specified, starting all queues' |
| 63 | ); |
| 64 | return [ |
| 65 | 'events', |
| 66 | 'events_kafka', |
| 67 | 'sessions', |
| 68 | 'cron', |
| 69 | 'notification', |
| 70 | 'import', |
| 71 | 'insights', |
| 72 | 'gsc', |
| 73 | 'cohortCompute', |
| 74 | ]; |
| 75 | } |
| 76 | |
| 77 | const queues = enabledQueuesEnv |
| 78 | .split(',') |
| 79 | .map((q) => q.trim()) |
| 80 | .filter(Boolean); |
| 81 | |
| 82 | logger.info( |
| 83 | { queues, totalEventShards: EVENTS_GROUP_QUEUES_SHARDS }, |
| 84 | 'Starting queues from ENABLED_QUEUES' |
| 85 | ); |
| 86 | return queues; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Gets the concurrency setting for a queue from environment variables. |
no test coverage detected