Skip to content

Commit

Permalink
continue of tls hotfix (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelxk authored Sep 17, 2022
1 parent e9f3ef6 commit 1c87ebd
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 194 deletions.
2 changes: 1 addition & 1 deletion compile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"dependencies": {
"body-parser": "^1.18.2",
"bull": "^3.29.0",
"bull": "^4.9.0",
"express": "^4.16.2",
"properties": "^1.2.1",
"redis-url-parse": "^2.0.0",
Expand Down
38 changes: 18 additions & 20 deletions compile/src/handlers/worker.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const { processJob } = require('../controllers/job')
const { compileLog } = require('../utils/base')
const { processJob } = require("../controllers/job")
const { compileLog } = require("../utils/base")

const Queue = require('bull')
const redisUrlParse = require('redis-url-parse')
const Queue = require("bull")
const redisUrlParse = require("redis-url-parse")

// Connect to a local redis instance locally, and the Heroku-provided URL in production
const REDIS_URL = process.env.REDIS_URL || 'redis://compile_queue:6379'
const { host, port, password } = redisUrlParse(REDIS_URL);
const bullOptions = REDIS_URL.includes('rediss://')
const REDIS_URL = process.env.REDIS_URL || "redis://compile_queue:6379"
const { host, port, password } = redisUrlParse(REDIS_URL)
const bullOptions = REDIS_URL.includes("rediss://")
? {
redis: {
port: Number(port),
Expand All @@ -19,25 +19,23 @@ const bullOptions = REDIS_URL.includes('rediss://')
},
},
}
: REDIS_URL;
: REDIS_URL
// The maximum number of jobs each worker should process at once
// Each job is CPU-intensive, so this value should not be too high
const maxJobsPerWorker = process.env.JOB_CONCURRENCY || 1

module.exports.init = () => {

// starting up the service
compileLog('Starting compile cluster')
// starting up the service
compileLog("Starting compile cluster")
}

module.exports.start = (id) => {

// Signal worked started
compileLog(`Started worker ${ id }`);
module.exports.start = id => {
// Signal worked started
compileLog(`Started worker ${id}`)

// Connect to the named queue
const compile_queue = new Queue('submissions', bullOptions)
// Connect to the named queue
const compile_queue = new Queue("submissions", bullOptions)

// start processing jobs from the submission queue
compile_queue.process(maxJobsPerWorker, processJob)
}
// start processing jobs from the submission queue
compile_queue.process(maxJobsPerWorker, processJob)
}
Loading

0 comments on commit 1c87ebd

Please sign in to comment.