Answer the question
In order to leave comments, you need to log in
Why is the process not ending?
Just started learning Node.js. I'm trying to work with Redis.
I do not understand why the process is not completed. What's wrong?
Took the example from https://github.com/NodeRedis/node-redis and added error handling.
import { createClient } from 'redis';
const redis_url = process.env.REDIS_URL;
console.log('redis: ' + redis_url);
(async () => {
const client = createClient({ url: redis_url });
client.on('error', err => console.log('Redis Client Error', err));
client.on('error', err => {
console.log('Redis Client Error', err);
throw new Error('Redis error occurred.');
});
await client.connect().catch(err => {
console.error(err);
throw new Error('connect error');
});
await client.set('key', 'zzz').catch(err => {
console.error(err);
throw new Error('set error');
});
const value = await client.get('key').catch(err => {
console.error(err);
throw new Error('get error');
});
console.log('value: ' + value);
})();
docker-compose up
. Answer the question
In order to leave comments, you need to log in
On the merits of your question:
What do you think, if you dialed a number on the phone, and the receiver was picked up on the other side, when will the call end?
redis client.quit
redis client.end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question