Skip to content
Snippets Groups Projects
Commit 8992e991 authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Shorter default lock wait for vehicle_locations

parent fadb65a7
No related branches found
No related tags found
1 merge request!1Implemented Embed-code generator interface
...@@ -366,13 +366,15 @@ class Nextbus(): ...@@ -366,13 +366,15 @@ class Nextbus():
return predictions return predictions
@classmethod @classmethod
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 Get vehicle GPS locations
""" """
if not agency_tags: if not agency_tags:
return [] 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):
db.session.begin() db.session.begin()
routes = db.session.query(Route).join(Agency)\ routes = db.session.query(Route).join(Agency)\
.options(joinedload('directions'))\ .options(joinedload('directions'))\
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment