jonthornton / MTAPI

JSON proxy server for the MTA's realtime New York City subway feed
281 stars 84 forks source link

Fixed bug with "updated" time in JSON response. #7

Closed mattsahn closed 7 years ago

mattsahn commented 7 years ago

I swapped 'data' and 'updated' elements of json responses. This is needed so that mta.last_update() picks up the most recent update time which happens in the 'data' functions (eg, get_by_id(), get_routes()). When running in non-threaded mode, I noticed that the "updated" time would be really old when there is a long gap between requests. It's because it was picking up the updated time from the previous request since the new response sends the last_update() time before it fetches anything new and updates _last_update. By swapping them, it will have the most up-to-date _last_update time.

jonthornton commented 7 years ago

Thanks!