+ public startConnector(connectorId: number): void {
+ if (this.connectorsStatus.has(connectorId) === false) {
+ logger.warn(`${this.logPrefix(connectorId)} trying to start on non existing connector`);
+ return;
+ }
+ if (this.connectorsStatus.get(connectorId)?.start === false) {
+ // Avoid hogging the event loop with a busy loop
+ setImmediate(() => {
+ this.internalStartConnector(connectorId).catch(() => {
+ /* This is intentional */
+ });
+ });
+ } else {
+ logger.warn(`${this.logPrefix(connectorId)} already started on connector`);
+ }
+ }
+
+ public stopConnector(connectorId: number): void {
+ this.connectorsStatus.set(connectorId, {
+ ...this.connectorsStatus.get(connectorId),
+ start: false,
+ });
+ }
+