Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: impl/memory/taskqueue_data.go

Issue 1312433013: Switch to external stringset implementation. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix nitish Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/memory/stringset.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/taskqueue_data.go
diff --git a/impl/memory/taskqueue_data.go b/impl/memory/taskqueue_data.go
index 4fca8d3655d74785489c49d05a6c0b71a2efc520..3a76dc0bd2e10d37692f797eb9c4ce4a70887c7e 100644
--- a/impl/memory/taskqueue_data.go
+++ b/impl/memory/taskqueue_data.go
@@ -16,6 +16,7 @@ import (
ds "github.com/luci/gae/service/datastore"
tq "github.com/luci/gae/service/taskqueue"
"github.com/luci/luci-go/common/clock"
+ "github.com/luci/luci-go/common/stringset"
)
var (
@@ -127,13 +128,7 @@ func (t *taskQueueData) purgeLocked(queueName string) error {
return nil
}
-var tqOkMethods = stringSet{
- "GET": {},
- "POST": {},
- "HEAD": {},
- "PUT": {},
- "DELETE": {},
-}
+var tqOkMethods = stringset.NewFromSlice("GET", "POST", "HEAD", "PUT", "DELETE")
func (t *taskQueueData) prepTask(c context.Context, ns string, task *tq.Task, queueName string) (*tq.Task, error) {
toSched := task.Duplicate()
@@ -152,7 +147,7 @@ func (t *taskQueueData) prepTask(c context.Context, ns string, task *tq.Task, qu
if toSched.Method == "" {
toSched.Method = "POST"
}
- if !tqOkMethods.has(toSched.Method) {
+ if !tqOkMethods.Has(toSched.Method) {
return nil, fmt.Errorf("taskqueue: bad method %q", toSched.Method)
}
if toSched.Method != "POST" && toSched.Method != "PUT" {
« no previous file with comments | « impl/memory/stringset.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698