0

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).

BlueBoy
  • 798
  • 1
  • 11
  • 22

2 Answers2

2

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).

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
  • "Which means other tasks which normally would run after the failed one may actually run before its retry attempt(s)" - Ouch. Good to know. Thanks. – BlueBoy Jun 20 '17 at 01:13
2

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.

nhanssens
  • 76
  • 1