Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Strand Lab
Strand Lab Cellxgene Gateway
Commits
91c96078
Commit
91c96078
authored
Oct 29, 2019
by
Alok Saldanha
Browse files
#9 fix race condition by grabbing lock before adding cache entry
parent
66f7a6b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
cellxgene_gateway/gateway.py
View file @
91c96078
...
...
@@ -11,7 +11,7 @@
import
datetime
import
os
import
logging
from
threading
import
Thread
from
threading
import
Thread
,
Lock
import
json
from
flask
import
(
...
...
@@ -168,15 +168,16 @@ def filecrawl():
rendered_html
=
rendered_html
,
)
entry_lock
=
Lock
()
@
app
.
route
(
"/view/<path:path>"
,
methods
=
[
"GET"
,
"PUT"
,
"POST"
])
def
do_view
(
path
):
dataset
=
get_dataset
(
path
)
file_path
=
get_file_path
(
dataset
)
match
=
cache
.
check_entry
(
dataset
)
if
match
is
None
:
uascripts
=
get_extra_scripts
()
match
=
cache
.
create_entry
(
dataset
,
file_path
,
uascripts
)
with
entry_lock
:
match
=
cache
.
check_entry
(
dataset
)
if
match
is
None
:
uascripts
=
get_extra_scripts
()
match
=
cache
.
create_entry
(
dataset
,
file_path
,
uascripts
)
match
.
timestamp
=
current_time_stamp
()
...
...
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