All files / redis-smq-monitor-app/tests/common shut-down.ts

100% Statements 23/23
100% Branches 0/0
100% Functions 1/1
100% Lines 23/23

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 2957x 57x 57x 57x 57x 57x 57x 57x 57x 57x 57x   57x 57x 57x 57x 57x 57x 57x 57x 57x 57x 57x       57x    
import { shutdownMessageManager } from './message-manager';
import { shutdownQueueManager } from './queue-manager';
import { shutdownRedisClients } from './redis-clients';
import { shutdownConsumers } from './consumers';
import { shutdownProducers } from './producers';
import { stopMonitorServer } from './monitor-server';
import { stopTimeSeriesWorker } from './time-series-clean-up-worker';
import { stopWebsocketHeartbeatStreamWorker } from './websocket-heartbeat-stream-worker';
import { stopWebsocketMainStreamWorker } from './websocket-main-stream-worker';
import { stopWebsocketOnlineStreamWorker } from './websocket-online-stream-worker';
import { stopWebsocketRateStreamWorker } from './websocket-rate-stream-worker';
 
export async function shutDown(): Promise<void> {
  await stopMonitorServer();
  await stopTimeSeriesWorker();
  await stopWebsocketHeartbeatStreamWorker();
  await stopWebsocketMainStreamWorker();
  await stopWebsocketOnlineStreamWorker();
  await stopWebsocketRateStreamWorker();
  await shutdownConsumers();
  await shutdownProducers();
  await shutdownMessageManager();
  await shutdownQueueManager();
 
  // Redis clients should be stopped in the last step, to avoid random errors from different
  // dependant components.
  await shutdownRedisClients();
}