Spike in 504 errors on countdown API


#1

From 11 February onwards (with the biggest spikes from 12 February right through until today), I have seen a huge spike in the number of 504 errors returned on the countdown API. It has degraded from a 99.8% success rate down to around 92% today.

To add to this, the 504 errors are not in the specification, so my response to the user is not too helpful as it’s just part of the catch all.

Any ideas?


#2

Hi,

504 errors are caused by the TfL API system being overloaded by requests. Reduce the rate of requests (cache your requests) or use a streaming API like “old” countdown system.


#3

Thanks - this all resolved itself with no action from me.


#4

The 504 message is resolved by making no requests for a bit. I think it might be an hour or so!

You might, in future, want to detect the 504 coming back from the server and put a small “sleep” into your code. I’m not sure if the overrun protection is done against the IP address or the API user account.


#5

Just to note, the countdown API doesn’t have a user account associated with it and this was happening from various IP addresses. A quick look at other apps which use the same countdown system showed that I wasn’t alone in this. This code doesn’t do auto-retry - the user will retry it manually and it is the same code which has been running since 2014. First time I have ever seen a 504 on the countdown system.