aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app/reporting_external.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-01-09 16:27:55 +0100
committerAleksandr Nogikh <nogikh@google.com>2024-01-09 17:48:04 +0000
commitb438bd66d6f95113d52f25c25bfef0e963c8ce8d (patch)
treeaffa3733771acfc752397dc89a1c6e712d4d622c /dashboard/app/reporting_external.go
parent83b32fe8f20dc1e910866fa110b0d872df283f03 (diff)
dashboard: introduce an emergency stop mode
Add an emergency stop button that can be used by any admin. After it's clicked two times, syzbot stops all reporting and recoding of new bugs. It's assumed that the stop mode is revoked by manually deleting an entry from the database.
Diffstat (limited to 'dashboard/app/reporting_external.go')
-rw-r--r--dashboard/app/reporting_external.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/dashboard/app/reporting_external.go b/dashboard/app/reporting_external.go
index e6f65c738..625476918 100644
--- a/dashboard/app/reporting_external.go
+++ b/dashboard/app/reporting_external.go
@@ -19,6 +19,9 @@ import (
// and report back bug status updates with apiReportingUpdate.
func apiReportingPollBugs(c context.Context, r *http.Request, payload []byte) (interface{}, error) {
+ if stop, err := emergentlyStopped(c); err != nil || stop {
+ return &dashapi.PollBugsResponse{}, err
+ }
req := new(dashapi.PollBugsRequest)
if err := json.Unmarshal(payload, req); err != nil {
return nil, fmt.Errorf("failed to unmarshal request: %w", err)
@@ -36,6 +39,9 @@ func apiReportingPollBugs(c context.Context, r *http.Request, payload []byte) (i
}
func apiReportingPollNotifications(c context.Context, r *http.Request, payload []byte) (interface{}, error) {
+ if stop, err := emergentlyStopped(c); err != nil || stop {
+ return &dashapi.PollNotificationsResponse{}, err
+ }
req := new(dashapi.PollNotificationsRequest)
if err := json.Unmarshal(payload, req); err != nil {
return nil, fmt.Errorf("failed to unmarshal request: %w", err)
@@ -48,6 +54,9 @@ func apiReportingPollNotifications(c context.Context, r *http.Request, payload [
}
func apiReportingPollClosed(c context.Context, r *http.Request, payload []byte) (interface{}, error) {
+ if stop, err := emergentlyStopped(c); err != nil || stop {
+ return &dashapi.PollClosedResponse{}, err
+ }
req := new(dashapi.PollClosedRequest)
if err := json.Unmarshal(payload, req); err != nil {
return nil, fmt.Errorf("failed to unmarshal request: %w", err)