Skip to content

Commit

Permalink
Make core API call non-blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
jfkonecn committed Oct 3, 2024
1 parent dafac59 commit 5662fa1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import { EvidenceApi } from 'app/shared/api/manual/evidence-api';
import { createGeneTypePayload, isGeneTypeChange } from 'app/shared/util/core-gene-type-submission/core-gene-type-submission';
import { GeneTypeApi } from 'app/shared/api/manual/gene-type-api';
import { flattenReviewPaths, useLastReviewedOnly } from 'app/shared/util/core-submission-shared/core-submission-utils';
import { notifyError } from 'app/oncokb-commons/components/util/NotificationUtils';
import { STOP_REVIEW_IF_CORE_SUBMISSION_FAILS } from 'app/shared/feature-flags';

export class FirebaseGeneReviewService {
firebaseRepository: FirebaseRepository;
Expand Down Expand Up @@ -180,31 +182,50 @@ export class FirebaseGeneReviewService {
}
}
} catch (error) {
throw new SentryError('Failed to create evidences when accepting changes in review mode', { hugoSymbol, reviewLevels, isGermline });
const sentryError = new SentryError('Failed to create evidences when accepting changes in review mode', {
hugoSymbol,
reviewLevels,
isGermline,
});
if (STOP_REVIEW_IF_CORE_SUBMISSION_FAILS) {
throw sentryError;
} else {
console.error(sentryError);
}
}

try {
if (geneTypePayload) {
await this.geneTypeClient.submitGeneTypeToCore(geneTypePayload);
}
} catch (error) {
throw new SentryError('Failed to submit evidences to core when accepting changes in review mode', {
const sentryError = new SentryError('Failed to submit evidences to core when accepting changes in review mode', {
hugoSymbol,
reviewLevels,
isGermline,
});
if (STOP_REVIEW_IF_CORE_SUBMISSION_FAILS) {
throw sentryError;
} else {
console.error(sentryError);
}
}

try {
if (hasEvidences) {
await this.evidenceClient.submitEvidences(evidences);
}
} catch (error) {
throw new SentryError('Failed to submit evidences to core when accepting changes in review mode', {
const sentryError = new SentryError('Failed to submit evidences to core when accepting changes in review mode', {
hugoSymbol,
reviewLevels,
isGermline,
});
if (STOP_REVIEW_IF_CORE_SUBMISSION_FAILS) {
throw sentryError;
} else {
console.error(sentryError);
}
}

let updateObject = {};
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/app/shared/feature-flags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const STOP_REVIEW_IF_CORE_SUBMISSION_FAILS: boolean = false;

0 comments on commit 5662fa1

Please sign in to comment.