From 8992e9913ed757b5ea83ad8d846297fd9b62e2d0 Mon Sep 17 00:00:00 2001 From: Anton Sarukhanov <code@ant.sr> Date: Sun, 1 May 2016 20:29:50 -0400 Subject: [PATCH] Shorter default lock wait for vehicle_locations --- nextbus.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nextbus.py b/nextbus.py index 2e88f85..4ca67cb 100644 --- a/nextbus.py +++ b/nextbus.py @@ -366,13 +366,15 @@ class Nextbus(): return predictions @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 """ 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): db.session.begin() routes = db.session.query(Route).join(Agency)\ .options(joinedload('directions'))\ -- GitLab