@nextastic/queue
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -64,10 +64,2 @@ #!/usr/bin/env node | ||
// src/start-dashboard.ts | ||
if (require.main === module) { | ||
const queueNames = import_node_process.default.argv.slice(2); | ||
if (queueNames.length === 0) { | ||
console.error("Please provide at least one queue name as an argument"); | ||
import_node_process.default.exit(1); | ||
} | ||
startDashboard(queueNames); | ||
} | ||
function startDashboard(queues2) { | ||
@@ -94,6 +86,9 @@ const serverAdapter = new import_express2.ExpressAdapter(); | ||
}); | ||
app.listen(3100, () => { | ||
const server = app.listen(3100, () => { | ||
console.log("Running on 3100..."); | ||
console.log("For the UI, open http://localhost:3100/jobs"); | ||
}); | ||
import_node_process.default.on("SIGTERM", () => server.close()); | ||
import_node_process.default.on("SIGINT", () => server.close()); | ||
return server; | ||
} | ||
@@ -105,7 +100,12 @@ | ||
const [_, ...queues2] = args._; | ||
startDashboard(queues2); | ||
return; | ||
const server = await startDashboard(queues2); | ||
return new Promise((resolve) => { | ||
server.on("close", resolve); | ||
}); | ||
} | ||
} | ||
cli((0, import_minimist.default)(process.argv.slice(2))); | ||
cli((0, import_minimist.default)(process.argv.slice(2))).catch((error) => { | ||
console.error("Error:", error); | ||
process.exit(1); | ||
}); | ||
//# sourceMappingURL=cli.js.map |
@@ -1,1 +0,1 @@ | ||
export declare function startDashboard(queues: string[]): void; | ||
export declare function startDashboard(queues: string[]): import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>; |
@@ -14,12 +14,2 @@ "use strict"; | ||
const get_queue_1 = require("./get-queue"); | ||
// Only run if ran directly from command line | ||
if (require.main === module) { | ||
// Get queue names from command line arguments, ignore first 2 args which are node and the script path | ||
const queueNames = node_process_1.default.argv.slice(2); | ||
if (queueNames.length === 0) { | ||
console.error('Please provide at least one queue name as an argument'); | ||
node_process_1.default.exit(1); | ||
} | ||
startDashboard(queueNames); | ||
} | ||
function startDashboard(queues) { | ||
@@ -47,3 +37,3 @@ const serverAdapter = new express_2.ExpressAdapter(); | ||
}); | ||
app.listen(3100, () => { | ||
const server = app.listen(3100, () => { | ||
// eslint-disable-next-line no-console | ||
@@ -54,2 +44,6 @@ console.log('Running on 3100...'); | ||
}); | ||
// Handle graceful shutdown | ||
node_process_1.default.on('SIGTERM', () => server.close()); | ||
node_process_1.default.on('SIGINT', () => server.close()); | ||
return server; | ||
} |
{ | ||
"name": "@nextastic/queue", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Queue provides an API to run background jobs for your application.", | ||
@@ -49,4 +49,4 @@ "repository": { | ||
"@nextastic/cache": "0.0.1", | ||
"@nextastic/logger": "0.0.1", | ||
"@nextastic/utils": "0.0.1", | ||
"@nextastic/logger": "0.0.1", | ||
"@nextastic/redis": "0.0.1" | ||
@@ -53,0 +53,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25905
552