Skip to content

Commit

Permalink
Fix When Some Minion Not Exists All Operation Failed #146
Browse files Browse the repository at this point in the history
  • Loading branch information
= authored and haimkastner committed Jun 20, 2020
1 parent cb8ca2d commit a947f8c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions backend/src/business-layer/operationsBl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BehaviorSubject, Observable, Subscriber } from 'rxjs';
import { Configuration } from '../config';
import { OperationsDal, OperationsDalSingleton } from '../data-layer/operationsDal';
import { SetLockOptions } from '../models/backendInterfaces';
import { ErrorResponse, MinionStatus, Operation, OperationActivity, OperationResult } from '../models/sharedInterfaces';
import { ErrorResponse, MinionStatus, Operation, OperationActivity, OperationResult, Minion } from '../models/sharedInterfaces';
import { logger } from '../utilities/logger';
import { Delay } from '../utilities/sleep';
import { MinionsBl, MinionsBlSingleton } from './minionsBl';
Expand Down Expand Up @@ -117,7 +117,13 @@ export class OperationsBl {

logger.info(`Setting minion ${activity.minionId} a new status by operation activity...`);

const minion = await this.minionsBl.getMinionById(activity.minionId);
let minion : Minion;
try {
minion = await this.minionsBl.getMinionById(activity.minionId);
} catch (error) {
logger.info(`Getting minion ${activity.minionId} failed, ignoring this minion activity`);
continue;
}

// If need to override, just remove any lock
if (options.overrideLock) {
Expand All @@ -141,7 +147,7 @@ export class OperationsBl {
} catch (error) {
logger.error(`[operation] Fail to set minion "${activity.minionId}" operation activity lock`);
}
// Else if need to set a 'lock', select the correct lock depend on the 'set status' value
// Else if need to set a 'lock', select the correct lock depend on the 'set status' value
} else if (options.lockStatus) {
try {
await this.minionsBl.setMinionCalibrate(activity.minionId, {
Expand Down

0 comments on commit a947f8c

Please sign in to comment.