BlueBoy
BlueBoy

Reputation: 856

Keeping task queues in chronological order in appengine

In google app engine, as you add tasks to the same push task queue, will they all be queued up one after another chronologically? Or is it possible that a task could be executed before another one although it was added last? (this is all assuming they are using the same queue).

Upvotes: 0

Views: 451

Answers (2)

nhanssens
nhanssens

Reputation: 76

Task Queues make no guarantees about execution order. In particular, tasks that are scheduled to run immediately follow a code path that can result in significant re-ordering. Behavior for push and pull queues is also distinctly different.

If you schedule tasks to run after a short time in the future, however, execution order is more likely to be eta order. Again, there are no guarantees, and you should engineer around out-of-order delivery being a normal, albeit uncommon, case. Failure modes would typically be a significant number of out-of-order tasks for a brief period, not an occasionally isolated out-of-order task.

Upvotes: 2

Dan Cornilescu
Dan Cornilescu

Reputation: 39824

Not necessarily. I can think of 2 cases where that might not happen:

  • tasks can have different ETAs (in the future, for example), the order would normally be the ETA one, see do google app engine pull queues return tasks in FIFO order?

  • task execution may fail (for whatever reason) and they may be automatically re-tried with a backoff scheme (i.e. after some delay). Which means other tasks which normally would run after the failed one may actually run before its retry attempt(s).

Upvotes: 2

Related Questions