From 394b5674956fb0d17bf36b030cf1401680bf358d Mon Sep 17 00:00:00 2001 From: Kevin Glisson Date: Mon, 11 Sep 2023 14:30:02 -0700 Subject: [PATCH] Adds initial canary support --- src/dispatch/signal/flows.py | 4 ++++ src/dispatch/signal/models.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/dispatch/signal/flows.py b/src/dispatch/signal/flows.py index 373ec4efa85f..680d10a75ed8 100644 --- a/src/dispatch/signal/flows.py +++ b/src/dispatch/signal/flows.py @@ -90,6 +90,10 @@ def signal_instance_create_flow( ) return signal_instance + # limited support for canary signals, just store the instance and return + if signal_instance.canary: + return signal_instance + if not signal_instance.signal.create_case: return signal_instance diff --git a/src/dispatch/signal/models.py b/src/dispatch/signal/models.py index 23dfd127e490..7639d55d838c 100644 --- a/src/dispatch/signal/models.py +++ b/src/dispatch/signal/models.py @@ -231,6 +231,7 @@ class SignalInstance(Base, TimeStampMixin, ProjectMixin): case_priority = relationship("CasePriority", backref="signal_instances") fingerprint = Column(String) filter_action = Column(String) + canary = Column(Boolean, default=False) raw = Column(JSONB) signal = relationship("Signal", backref="instances") signal_id = Column(Integer, ForeignKey("signal.id")) @@ -301,6 +302,7 @@ class SignalBase(DispatchBase): case_type: Optional[CaseTypeRead] case_priority: Optional[CasePriorityRead] external_id: str + canary: Optional[bool] = False enabled: Optional[bool] = False external_url: Optional[str] create_case: Optional[bool] = True