Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Uroš Marolt committed Dec 12, 2023
1 parent ddb1143 commit ef8d10c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion backend/.env.dist.local
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ CROWD_API_JWT_EXPIRES_IN='100 years'
CROWD_SQS_HOST=localhost
CROWD_SQS_PORT=9324
CROWD_SQS_ENDPOINT=http://localhost:9324
CROWD_SQS_NODEJS_WORKER_QUEUE=http://localhost:9324/000000000000/nodejs-worker-normal.fifo
CROWD_SQS_NODEJS_WORKER_QUEUE=http://localhost:9324/000000000000/nodejs-worker.fifo
CROWD_SQS_NODEJS_WORKER_PRIORITY_QUEUE=http://localhost:9324/000000000000/nodejs-worker-normal.fifo
CROWD_SQS_PYTHON_WORKER_QUEUE=http://localhost:9324/000000000000/python-worker.fifo
CROWD_SQS_AWS_ACCOUNT_ID=000000000000
CROWD_SQS_AWS_ACCESS_KEY_ID=x
Expand Down
1 change: 1 addition & 0 deletions backend/config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"host": "CROWD_SQS_HOST",
"port": "CROWD_SQS_PORT",
"nodejsWorkerQueue": "CROWD_SQS_NODEJS_WORKER_QUEUE",
"nodejsWorkerPriorityQueue": "CROWD_SQS_NODEJS_WORKER_PRIORITY_QUEUE",
"integrationRunWorkerQueue": "CROWD_SQS_INTEGRATION_RUN_WORKER_QUEUE",
"pythonWorkerQueue": "CROWD_SQS_PYTHON_WORKER_QUEUE",
"aws": {
Expand Down
9 changes: 6 additions & 3 deletions backend/src/bin/nodejs-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ const removeWorkerJob = (): void => {
processingMessages--
}

async function handleMessages() {
async function handleMessages(queue: string) {
const handlerLogger = getChildLogger('messages', serviceLogger, {
queue: SQS_CONFIG.nodejsWorkerQueue,
queue,
})
handlerLogger.info('Listening for messages!')

Expand Down Expand Up @@ -181,7 +181,10 @@ setImmediate(async () => {
await initRedisSeq()

await getNodejsWorkerEmitter()
await handleMessages()
await Promise.all([
handleMessages(SQS_CONFIG.nodejsWorkerQueue),
handleMessages(SQS_CONFIG.nodejsWorkerPriorityQueue),
])
})

const liveFilePath = path.join(__dirname, 'tmp/nodejs-worker-live.tmp')
Expand Down
1 change: 1 addition & 0 deletions backend/src/conf/configTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface SQSConfiguration {
host?: string
port?: number
nodejsWorkerQueue: string
nodejsWorkerPriorityQueue: string
integrationRunWorkerQueue: string
pythonWorkerQueue: string
aws: AwsCredentials
Expand Down

0 comments on commit ef8d10c

Please sign in to comment.