Index: impl/memory/taskqueue_data.go |
diff --git a/impl/memory/taskqueue_data.go b/impl/memory/taskqueue_data.go |
index 906da1c8fe7a9a6ef687c9a384c01436106ffecd..9d7648fc28888cdb685434a5c2c1c63667790d84 100644 |
--- a/impl/memory/taskqueue_data.go |
+++ b/impl/memory/taskqueue_data.go |
@@ -124,13 +124,8 @@ var tqOkMethods = map[string]struct{}{ |
"DELETE": {}, |
} |
-func (t *taskQueueData) prepTask(c context.Context, ns string, task *tq.Task, queueName string) (*tq.Task, string, error) { |
- queueName, err := t.getQueueName(queueName) |
- if err != nil { |
- return nil, "", err |
- } |
- |
- toSched := dupTask(task) |
+func (t *taskQueueData) prepTask(c context.Context, ns string, task *tq.Task, queueName string) (*tq.Task, error) { |
+ toSched := task.Duplicate() |
if toSched.Path == "" { |
toSched.Path = "/_ah/queue/" + queueName |
@@ -147,7 +142,7 @@ func (t *taskQueueData) prepTask(c context.Context, ns string, task *tq.Task, qu |
toSched.Method = "POST" |
} |
if _, ok := tqOkMethods[toSched.Method]; !ok { |
- return nil, "", fmt.Errorf("taskqueue: bad method %q", toSched.Method) |
+ return nil, fmt.Errorf("taskqueue: bad method %q", toSched.Method) |
} |
if toSched.Method != "POST" && toSched.Method != "PUT" { |
toSched.Payload = nil |
@@ -167,11 +162,11 @@ func (t *taskQueueData) prepTask(c context.Context, ns string, task *tq.Task, qu |
toSched.Name = mkName(c, "", t.named[queueName]) |
} else { |
if !validTaskName.MatchString(toSched.Name) { |
- return nil, "", errors.New("INVALID_TASK_NAME") |
+ return nil, errors.New("INVALID_TASK_NAME") |
} |
} |
- return toSched, queueName, nil |
+ return toSched, nil |
} |
/////////////////////////////// txnTaskQueueData /////////////////////////////// |
@@ -201,15 +196,6 @@ func (t *txnTaskQueueData) endTxn() { |
atomic.StoreInt32(&t.closed, 1) |
} |
-func (t *txnTaskQueueData) run(f func() error) error { |
- // Slightly different from the SDK... datastore and taskqueue each implement |
- // this here, where in the SDK only datastore.transaction.Call does. |
- if atomic.LoadInt32(&t.closed) == 1 { |
- return fmt.Errorf("taskqueue: transaction context has expired") |
- } |
- return f() |
-} |
- |
func (t *txnTaskQueueData) ResetTasks() { |
t.Lock() |
defer t.Unlock() |
@@ -237,7 +223,7 @@ func (t *txnTaskQueueData) GetTransactionTasks() tq.AnonymousQueueData { |
for k, vs := range t.anony { |
ret[k] = make([]*tq.Task, len(vs)) |
for i, v := range vs { |
- tsk := dupTask(v) |
+ tsk := v.Duplicate() |
tsk.Name = "" |
ret[k][i] = tsk |
} |