Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Anton Sarukhanov
PyBusMap
Commits
8992e991
Commit
8992e991
authored
May 01, 2016
by
Anton Sarukhanov
Browse files
Shorter default lock wait for vehicle_locations
parent
fadb65a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
nextbus.py
View file @
8992e991
...
...
@@ -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'
))
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment