mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-31 21:11:33 +02:00
refactor: refactor the queue init function
This commit is contained in:
+10
-20
@@ -9,11 +9,13 @@ export let downloadQueue: Queue<Repository>;
|
|||||||
|
|
||||||
// avoid to load the queue outside the main server
|
// avoid to load the queue outside the main server
|
||||||
export function startWorker() {
|
export function startWorker() {
|
||||||
|
const connection = {
|
||||||
|
host: config.REDIS_HOSTNAME,
|
||||||
|
port: config.REDIS_PORT,
|
||||||
|
};
|
||||||
|
|
||||||
cacheQueue = new Queue<Repository>("cache removal", {
|
cacheQueue = new Queue<Repository>("cache removal", {
|
||||||
connection: {
|
connection,
|
||||||
host: config.REDIS_HOSTNAME,
|
|
||||||
port: config.REDIS_PORT,
|
|
||||||
},
|
|
||||||
defaultJobOptions: {
|
defaultJobOptions: {
|
||||||
removeOnComplete: true,
|
removeOnComplete: true,
|
||||||
},
|
},
|
||||||
@@ -28,10 +30,7 @@ export function startWorker() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
downloadQueue = new Queue<Repository>("repository download", {
|
downloadQueue = new Queue<Repository>("repository download", {
|
||||||
connection: {
|
connection,
|
||||||
host: config.REDIS_HOSTNAME,
|
|
||||||
port: config.REDIS_PORT,
|
|
||||||
},
|
|
||||||
defaultJobOptions: {
|
defaultJobOptions: {
|
||||||
removeOnComplete: true,
|
removeOnComplete: true,
|
||||||
},
|
},
|
||||||
@@ -41,10 +40,7 @@ export function startWorker() {
|
|||||||
path.resolve("build/src/processes/removeCache.js"),
|
path.resolve("build/src/processes/removeCache.js"),
|
||||||
{
|
{
|
||||||
concurrency: 5,
|
concurrency: 5,
|
||||||
connection: {
|
connection,
|
||||||
host: config.REDIS_HOSTNAME,
|
|
||||||
port: config.REDIS_PORT,
|
|
||||||
},
|
|
||||||
autorun: true,
|
autorun: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -56,10 +52,7 @@ export function startWorker() {
|
|||||||
path.resolve("build/src/processes/removeRepository.js"),
|
path.resolve("build/src/processes/removeRepository.js"),
|
||||||
{
|
{
|
||||||
concurrency: 5,
|
concurrency: 5,
|
||||||
connection: {
|
connection,
|
||||||
host: config.REDIS_HOSTNAME,
|
|
||||||
port: config.REDIS_PORT,
|
|
||||||
},
|
|
||||||
autorun: true,
|
autorun: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -72,10 +65,7 @@ export function startWorker() {
|
|||||||
path.resolve("build/src/processes/downloadRepository.js"),
|
path.resolve("build/src/processes/downloadRepository.js"),
|
||||||
{
|
{
|
||||||
concurrency: 3,
|
concurrency: 3,
|
||||||
connection: {
|
connection,
|
||||||
host: config.REDIS_HOSTNAME,
|
|
||||||
port: config.REDIS_PORT,
|
|
||||||
},
|
|
||||||
autorun: true,
|
autorun: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user