Chromium Code Reviews| Index: go/src/infra/gae/libs/wrapper/memory/taskqueue.go |
| diff --git a/go/src/infra/gae/libs/wrapper/memory/taskqueue.go b/go/src/infra/gae/libs/wrapper/memory/taskqueue.go |
| index d2c6b8ef2d4af91f928244a12d0cbd3602cf24cf..472d8758d5ec372bc54b9eb12f11fd709046ff0f 100644 |
| --- a/go/src/infra/gae/libs/wrapper/memory/taskqueue.go |
| +++ b/go/src/infra/gae/libs/wrapper/memory/taskqueue.go |
| @@ -7,10 +7,10 @@ package memory |
| import ( |
| "fmt" |
| "infra/gae/libs/wrapper" |
| + "infra/libs/clock" |
| "math/rand" |
| "net/http" |
| "regexp" |
| - "time" |
| "golang.org/x/net/context" |
| @@ -35,8 +35,8 @@ func useTQ(c context.Context) context.Context { |
| ret = &taskqueueImpl{ |
| wrapper.DummyTQ(), |
| x, |
| + ic, |
| curGID(ic).namespace, |
| - func() time.Time { return wrapper.GetTimeNow(ic) }, |
| wrapper.GetMathRand(ic), |
| } |
| @@ -44,8 +44,8 @@ func useTQ(c context.Context) context.Context { |
| ret = &taskqueueTxnImpl{ |
| wrapper.DummyTQ(), |
| x, |
| + ic, |
| curGID(ic).namespace, |
| - func() time.Time { return wrapper.GetTimeNow(ic) }, |
| wrapper.GetMathRand(ic), |
| } |
| @@ -62,8 +62,8 @@ type taskqueueImpl struct { |
| wrapper.TaskQueue |
| *taskQueueData |
| + ctx context.Context |
| ns string |
| - timeNow func() time.Time |
| mathRand *rand.Rand |
|
iannucci
2015/06/03 17:37:19
could we pull out mathRand the same way too? (e.g.
dnj
2015/06/03 18:21:26
Done.
|
| } |
| @@ -73,7 +73,7 @@ var ( |
| ) |
| func (t *taskqueueImpl) addLocked(task *taskqueue.Task, queueName string) (*taskqueue.Task, error) { |
| - toSched, queueName, err := t.prepTask(t.ns, task, queueName, t.timeNow(), t.mathRand) |
| + toSched, queueName, err := t.prepTask(t.ns, task, queueName, clock.Now(t.ctx), t.mathRand) |
| if err != nil { |
| return nil, err |
| } |
| @@ -164,8 +164,8 @@ type taskqueueTxnImpl struct { |
| wrapper.TaskQueue |
| *txnTaskQueueData |
| + ctx context.Context |
| ns string |
| - timeNow func() time.Time |
| mathRand *rand.Rand |
| } |
| @@ -175,7 +175,7 @@ var ( |
| ) |
| func (t *taskqueueTxnImpl) addLocked(task *taskqueue.Task, queueName string) (*taskqueue.Task, error) { |
| - toSched, queueName, err := t.parent.prepTask(t.ns, task, queueName, t.timeNow(), t.mathRand) |
| + toSched, queueName, err := t.parent.prepTask(t.ns, task, queueName, clock.Now(t.ctx), t.mathRand) |
| if err != nil { |
| return nil, err |
| } |