WorldBank-Transport/open-transit-indicators — pull request #498 by moradology (2014-11-21 21:12:57+00:00)
Title: Better race condition ordering

This very small change doesn't fix a race condition that apparently causes status indicators to be posted to DB by django slightly out of the expected order, but it does make that race far more predictable.

Because trackstatus pushes to django after every indicator's successful calculation, it is possible that the last and second to last calculation will be sent to django at almost exactly the same time. Django, running in multiple works, will then non-deterministically apply changes to DB, potentially messing up the ordering that we would normally expect.

By shifting weekly service hours to the very end of the calculation chain, we are effectively putting ~10 seconds between the second to last and the last post to django. This ought to prevent the status-limbo that the race condition makes possible.

Go ahead and merge this in lieu of a +1 - I'll be on a plane to KS.