mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: migration
This commit is contained in:
24
apps/mig/server/queues/queueSetup.ts
Normal file
24
apps/mig/server/queues/queueSetup.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { type ConnectionOptions, Queue } from "bullmq";
|
||||
|
||||
export const redisConfig: ConnectionOptions = {
|
||||
host: process.env.NODE_ENV === "production" ? "dokploy-redis" : "127.0.0.1",
|
||||
};
|
||||
const myQueue = new Queue("deployments", {
|
||||
connection: redisConfig,
|
||||
});
|
||||
|
||||
process.on("SIGTERM", () => {
|
||||
myQueue.close();
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
myQueue.on("error", (error) => {
|
||||
if ((error as any).code === "ECONNREFUSED") {
|
||||
console.error(
|
||||
"Make sure you have installed Redis and it is running.",
|
||||
error,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export { myQueue };
|
||||
Reference in New Issue
Block a user