0

I am trying to have some task in a push queue to be executed at rate of about once a second.
Here is how I defined my queue.yaml

queue:
- name: default
  rate: 1/s
  bucket_size: 1
  max_concurrent_requests: 1

I have a handler (for /tasks/readalerts), that enqueues the task:

t := taskqueue.NewPOSTTask("/tasks/readalerts", map[string][]string{})
if _, err := taskqueue.Add(context, t, ""); err != nil {
  context.Errorf("%v", err)
} 

Once I visit the /tasks/readalerts the task is indeed being enqueued but it seems like it is running once in about 60ms (this is happening on dev machine, didn't try to deploy it).

What am I missing? shouldn't there be at least 1 second between each task execution?

Thanks, Itay

Itay Karo
  • 17,924
  • 4
  • 40
  • 58

1 Answers1

0

OK, seems like what I was missing is setting the Delay field of the task.
This will do the trick:

t := taskqueue.NewPOSTTask("/tasks/readalerts", map[string][]string{}) 
t.Delay = time.Second
Itay Karo
  • 17,924
  • 4
  • 40
  • 58