diff --git a/__pycache__/app.py.cpython-313.pyc b/__pycache__/app.py.cpython-313.pyc index 9785cdb..a570823 100644 Binary files a/__pycache__/app.py.cpython-313.pyc and b/__pycache__/app.py.cpython-313.pyc differ diff --git a/app.py.final b/app.py.final index 059906b..181c668 100644 --- a/app.py.final +++ b/app.py.final @@ -31,7 +31,41 @@ if not os.path.exists(TEMP_DIR): os.makedirs(TEMP_DIR) # Global task store -TASKS = {} +import threading +_task_lock = threading.Lock() +_TASK_FILE = '/tmp/seismic_tasks.json' + +def _load_tasks(): + try: + with open(_TASK_FILE) as f: + return json.load(f) + except: + return {} + +def _save_tasks(tasks): + with open(_TASK_FILE, 'w') as f: + json.dump(tasks, f) + +class TasksProxy: + def get(self, key, default=None): + return _load_tasks().get(key, default) + def __setitem__(self, key, value): + with _task_lock: + tasks = _load_tasks() + tasks[key] = value + _save_tasks(tasks) + def __getitem__(self, key): + return _load_tasks()[key] + def __contains__(self, key): + return key in _load_tasks() + def pop(self, key, *args): + with _task_lock: + tasks = _load_tasks() + result = tasks.pop(key, *args) + _save_tasks(tasks) + return result + +TASKS = TasksProxy() # ========== UTILITY FUNCTIONS ========== diff --git a/index.html.final b/index.html.final index 0317ea4..6930367 100644 --- a/index.html.final +++ b/index.html.final @@ -2607,7 +2607,7 @@ async function doExtract() { await new Promise(function(resolve) { setTimeout(resolve, 2000); }); var sr = await fetch(API + '/tasks/' + taskId); var sd = await sr.json(); - if (sd.status === 'done') { + if (sd.status === 'completed') { setInfo('📥 Downloading ZIP...'); var dr = await fetch(API + '/tasks/' + taskId + '/download'); var blob = await dr.blob();