diff options
| author | Julie Qiu <julie@golang.org> | 2020-06-01 11:45:41 -0400 |
|---|---|---|
| committer | Julie Qiu <julieqiu@google.com> | 2020-06-02 00:27:30 +0000 |
| commit | 0bbc5df5bf4a85d1c44db11afcd1e2e7c2dc52d4 (patch) | |
| tree | 580d776f8c7fcdc003895429b3901bdf918ba0a8 /internal/queue/queue_test.go | |
| parent | 1d5b18fc5d996d0c8e5596faeaef044bccf69220 (diff) | |
| download | go-x-pkgsite-0bbc5df5bf4a85d1c44db11afcd1e2e7c2dc52d4.tar.xz | |
cmd,internal: move taskIDChangeInterval to config
At the moment, taskIDChangeInterval is a hardcoded value in
internal/queue. However, we will soon have two task queues running,
which require different change intervals, so this value is now set in
internal/config.
Additionally, the taskIDChangeInterval for the worker is changed to 3
hours.
Change-Id: I498abefce6543005463be7da99a5a778f3a6e973
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/758919
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/queue/queue_test.go')
| -rw-r--r-- | internal/queue/queue_test.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/queue/queue_test.go b/internal/queue/queue_test.go index 3933325b..429e8017 100644 --- a/internal/queue/queue_test.go +++ b/internal/queue/queue_test.go @@ -12,18 +12,18 @@ import ( func TestNewTaskID(t *testing.T) { // Verify that the task ID is the same within taskIDChangeInterval and changes // afterwards. - const ( - module = "mod" - version = "ver" + var ( + module = "mod" + version = "ver" + taskIDChangeInterval = 3 * time.Hour ) - tm := time.Now().Truncate(taskIDChangeInterval) - id1 := newTaskID(module, version, tm) - id2 := newTaskID(module, version, tm.Add(taskIDChangeInterval/2)) + id1 := newTaskID(module, version, tm, taskIDChangeInterval) + id2 := newTaskID(module, version, tm.Add(taskIDChangeInterval/2), taskIDChangeInterval) if id1 != id2 { t.Error("wanted same task ID, got different") } - id3 := newTaskID(module, version, tm.Add(taskIDChangeInterval+1)) + id3 := newTaskID(module, version, tm.Add(taskIDChangeInterval+1), taskIDChangeInterval) if id1 == id3 { t.Error("wanted different task ID, got same") } |
