Arrivals timeToStation

Hi all,

I’ve noticed that for repeated requests to https://api.tfl.gov.uk/StopPoint/{id}/Arrivals for the same id
the timeToStation value can slightly change on each request for a given line with a pattern like:

1st req: timeToStation 59
2nd req: timeToStation 62
3rd request: timeToStation 59
4th request: timeToStation 62
and so on with a spacing of secs between requests.

Can this pattern depends on the fact that the load balancer is redirecting the request to different servers which then reply with slightly different results ?

If so, would it be possible to set a cookie in the http request to route follow-up requests from the same client to the same server (something like sticky sessions) ?

I’ve also observed that the same alternating pattern happens on the whole prediction for a given line.
Example:
1st req: prediction for bus 321 is present
2dn req: prediction for bus 321 is absent
3rd req: prediction for bus 321 is present
4th req: prediction for bus 321 is absent

and so on.

Are others experiencing the same issue ?

Thank you

Welcome @nakkore

Could you cache the results on your own server? If you aren’t wanting new information (and there doesn’t seem to be any) then you can cache these results for, say, 60 seconds in a memcached?

This would also address the second issue?

Thank you @briantist caching could be a workaround but I was interested in understanding if there’s a server problem or the reasons why this is happening. Recently it seems to happen more frequently than in the past so I suspect there could be something which is not right worth an investigation.
On second thought caching may not even be a workaround as in case of the second issue you wouldn’t have the chance of seeing the “intermittent” bus for one long minute (or whatever T you decide).
I hope that @jamesevans can comment on this issue please.