#9 fix race condition by grabbing lock before adding cache entry

This commit is contained in:
Alok Saldanha
2019-10-29 21:19:50 -04:00
parent 66f7a6b5a7
commit 91c9607808

View File

@@ -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,11 +168,12 @@ 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)
with entry_lock:
match = cache.check_entry(dataset)
if match is None:
uascripts = get_extra_scripts()