From 8497091309abf045a9dae59ae0a785096aa1462d Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Sun, 9 Jul 2023 11:09:57 +0300 Subject: [PATCH] clening --- todo-service/Dockerfile | 20 ++++++++++++++++++++ todo-service/package.json | 2 +- todo-service/src/rabbitmq/RabbitMQ.ts | 4 ++-- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 todo-service/Dockerfile diff --git a/todo-service/Dockerfile b/todo-service/Dockerfile new file mode 100644 index 0000000..8784681 --- /dev/null +++ b/todo-service/Dockerfile @@ -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"] diff --git a/todo-service/package.json b/todo-service/package.json index 40e9b4d..f3d8678 100644 --- a/todo-service/package.json +++ b/todo-service/package.json @@ -4,7 +4,7 @@ "description": "", "main": "main.js", "scripts": { - "dev": "nodemon dist/main.js" + "dev": "node dist/main.js" }, "keywords": [], "author": "", diff --git a/todo-service/src/rabbitmq/RabbitMQ.ts b/todo-service/src/rabbitmq/RabbitMQ.ts index 18941bd..c28a3a9 100644 --- a/todo-service/src/rabbitmq/RabbitMQ.ts +++ b/todo-service/src/rabbitmq/RabbitMQ.ts @@ -58,7 +58,7 @@ export class RabbitMQ { headers: { "x-delay": delayTimeForQueue }, }; try { - await this.channel.publish( + this.channel.publish( this.exchange, this.queue, Buffer.from(message), @@ -73,6 +73,6 @@ export class RabbitMQ { calculateDelayTimeForQueue(payload: ITodo) { const delayTime = payload.due_date.getTime() - Date.now(); - return 0; + return delayTime; } }