skip to Main Content

How to hold a lock to redis?

I have the following NodeJS code that initialize a list only if the list doesn't exist. if (redisClient.lLen('mylist') === 0) { let initialVal = Array(100).fill(-1) await redisClient.rPush('mylist', initialVal) } If the above code is running at the same time by…

VIEW QUESTION

Dockerfile can not see package.json file

I've got this structure of the project: - project -- apps --- microservice-one ---- Dockerfile -- package.json -- docker-compose.yml Here is my Dockerfile from the microservice-one: FROM node:12.13-alpine As development WORKDIR /usr/src/app COPY package*.json ./ RUN npm install COPY .…

VIEW QUESTION

Unable to connect to remote redis host [nodeJS]

const redis = require('redis'); require('dotenv').config(); console.log(process.env.redisHost, ':', process.env.redisPort); const redisClient = redis.createClient({ host: process.env.redisHost, port: process.env.redisPort, password: process.env.redisKey }); redisClient.connect(); redisClient.on('error', err => console.log('Redis error: ', err.message)); redisClient.on('connect', () => console.log('Connected to redis server')); module.exports = redisClient; I tried this…

VIEW QUESTION
Back To Top
Search