From cd2aad5cfbbaf392a6855fd78769a51d480f6ddb Mon Sep 17 00:00:00 2001 From: Mikhail Atuchin Date: Wed, 20 Sep 2023 17:55:37 +0600 Subject: [PATCH] Improve killswitch detection --- src/core/study_processor.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/study_processor.ts b/src/core/study_processor.ts index b3e914e7..a79f0a49 100644 --- a/src/core/study_processor.ts +++ b/src/core/study_processor.ts @@ -155,7 +155,14 @@ export class StudyDetails { console.error('Bad study ' + JSON.stringify(study)); return; } - this.isEmergency = study.name.match(/KillSwitch/) !== null; + const isKillSwitch = (s: string) => { + return s.match(/(K|k)ill(S|s)witch/) !== null; + }; + this.isEmergency = + isKillSwitch(study.name) || + study.experiment?.find( + (e) => e.probability_weight > 0 && isKillSwitch(e.name), + ) !== undefined; if (maxVersion != null) { const parsed = parseVersionPattern(maxVersion);