Skip to content

Commit 76bc41b

Browse files
committed
feat(queuepause): Read an optional reason for each queue in the file store
1 parent de7e380 commit 76bc41b

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎submitqueue/extension/queuepause/file/file.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// - name: my-queue
2121
// reject_lands: true
2222
// freeze_processing: false
23+
// reason: repo freeze until 17:00
2324
//
2425
// A queue with no entry is not paused. The file must exist and parse when the
2526
// Store is constructed, so a mistyped path fails at startup. A later read or
@@ -49,6 +50,7 @@ type queueEntry struct {
4950
Name string `yaml:"name"`
5051
RejectLands bool `yaml:"reject_lands"`
5152
FreezeProcessing bool `yaml:"freeze_processing"`
53+
Reason string `yaml:"reason"`
5254
}
5355

5456
// Store is a queuepause.Store backed by a YAML file that is re-read on every
@@ -103,6 +105,7 @@ func load(path string) (map[string]entity.QueuePause, error) {
103105
states[q.Name] = entity.QueuePause{
104106
RejectLands: q.RejectLands,
105107
FreezeProcessing: q.FreezeProcessing,
108+
Reason: q.Reason,
106109
}
107110
}
108111
return states, nil

‎submitqueue/extension/queuepause/file/file_test.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ queues:
4242
- name: both
4343
reject_lands: true
4444
freeze_processing: true
45+
- name: with-reason
46+
reject_lands: true
47+
reason: repo freeze until 17:00
4548
- name: listed-but-running
4649
`
4750
tests := []struct {
@@ -52,6 +55,7 @@ queues:
5255
{name: "reject only", queue: "rejecting", want: entity.QueuePause{RejectLands: true}},
5356
{name: "freeze only", queue: "freezing", want: entity.QueuePause{FreezeProcessing: true}},
5457
{name: "both switches", queue: "both", want: entity.QueuePause{RejectLands: true, FreezeProcessing: true}},
58+
{name: "reason is carried", queue: "with-reason", want: entity.QueuePause{RejectLands: true, Reason: "repo freeze until 17:00"}},
5559
{name: "listed with no switches set", queue: "listed-but-running", want: entity.QueuePause{}},
5660
{name: "unlisted queue is not paused", queue: "other", want: entity.QueuePause{}},
5761
}

0 commit comments

Comments
 (0)