feat: Implement draft version of reset password email (#949)

This commit is contained in:
Ömer Faruk Aydın
2023-02-24 00:25:10 +01:00
committed by GitHub
parent bd02b7574a
commit a0815b06a6
9 changed files with 141 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
import process from 'process';
import { Queue } from 'bullmq';
import redisConfig from '../config/redis';
import logger from '../helpers/logger';
const CONNECTION_REFUSED = 'ECONNREFUSED';
const redisConnection = {
connection: redisConfig,
};
const emailQueue = new Queue('email', redisConnection);
process.on('SIGTERM', async () => {
await emailQueue.close();
});
emailQueue.on('error', (err) => {
if ((err as any).code === CONNECTION_REFUSED) {
logger.error('Make sure you have installed Redis and it is running.', err);
process.exit();
}
});
export default emailQueue;