Commit 8992e991 authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Shorter default lock wait for vehicle_locations

parent fadb65a7
......@@ -366,13 +366,15 @@ class Nextbus():
return predictions
def get_vehicle_locations(cls, agency_tags, truncate=True):
def get_vehicle_locations(cls, agency_tags, truncate=True, max_wait=10):
Get vehicle GPS locations
if not agency_tags:
return []
with Lock("agencies", shared=True), Lock("routes", shared=True), Lock("vehicle_locations"):
with Lock("agencies", shared=True, timeout=max_wait),\
Lock("routes", shared=True, timeout=max_wait),\
Lock("vehicle_locations", timeout=max_wait):
routes = db.session.query(Route).join(Agency)\
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment