clening
This commit is contained in:
parent
46f78fa563
commit
8497091309
3 changed files with 23 additions and 3 deletions
20
todo-service/Dockerfile
Normal file
20
todo-service/Dockerfile
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Use the official Node.js 14 image as the base
|
||||||
|
FROM node:14
|
||||||
|
|
||||||
|
# Set the working directory in the container
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package.json and package-lock.json to the container
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install project dependencies
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# Copy the rest of the application code to the container
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Expose the port on which your Express app listens
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Start the application in development mode
|
||||||
|
CMD ["npm", "run", "dev"]
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nodemon dist/main.js"
|
"dev": "node dist/main.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|
|
@ -58,7 +58,7 @@ export class RabbitMQ {
|
||||||
headers: { "x-delay": delayTimeForQueue },
|
headers: { "x-delay": delayTimeForQueue },
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await this.channel.publish(
|
this.channel.publish(
|
||||||
this.exchange,
|
this.exchange,
|
||||||
this.queue,
|
this.queue,
|
||||||
Buffer.from(message),
|
Buffer.from(message),
|
||||||
|
@ -73,6 +73,6 @@ export class RabbitMQ {
|
||||||
|
|
||||||
calculateDelayTimeForQueue(payload: ITodo) {
|
calculateDelayTimeForQueue(payload: ITodo) {
|
||||||
const delayTime = payload.due_date.getTime() - Date.now();
|
const delayTime = payload.due_date.getTime() - Date.now();
|
||||||
return 0;
|
return delayTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue