Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 57x 57x 57x 57x 57x 29x 29x 29x 29x 57x 57x 29x 29x 29x 29x 57x | import { IConfig } from 'redis-smq/dist/types'; import { config } from './config'; import { events, Producer } from 'redis-smq'; import { promisifyAll } from 'bluebird'; let producersList: Producer[] = []; export function getProducer(cfg: IConfig = config) { const producer = new Producer(cfg); const p = promisifyAll(producer); producersList.push(p); return p; } export async function shutdownProducers() { for (const i of producersList) { Iif (i.isGoingUp()) { await new Promise((resolve) => { i.once(events.UP, resolve); }); } if (i.isRunning()) { // eslint-disable-next-line no-await-in-loop await new Promise((resolve) => { i.shutdown(resolve); }); } } producersList = []; } |