fix(dashcam): prevent site freeze during import/convert
- _convert_bg now runs in real threading.Thread (not gevent greenlet) so ffmpeg proc.wait() doesn't block gevent event loop - _device_lock released before copy loop; only held for mount/unmount so /api/dash/files and other routes don't block during long copies - Date now shows time (Aug 9, 10:30 PM) on mobile video rows - Spacing added above converting spinner badge Co-authored-by: Copilot <[email protected]>
This commit is contained in:
+13
-11
@@ -559,17 +559,19 @@ def import_dashcam(
|
||||
"message": f"Failed to mount {device_path}.",
|
||||
}
|
||||
|
||||
try:
|
||||
summary = copy_files(source, destination_folder, relative_paths)
|
||||
summary["status"] = (
|
||||
"invalid_selection" if summary.pop("invalid_selection", False) else "ok"
|
||||
)
|
||||
if summary["status"] == "invalid_selection":
|
||||
summary["message"] = summary["errors"][0]
|
||||
summary["device"] = device_path
|
||||
return summary
|
||||
finally:
|
||||
if mounted_here:
|
||||
# Lock released — copy runs without blocking other requests
|
||||
try:
|
||||
summary = copy_files(source, destination_folder, relative_paths)
|
||||
summary["status"] = (
|
||||
"invalid_selection" if summary.pop("invalid_selection", False) else "ok"
|
||||
)
|
||||
if summary["status"] == "invalid_selection":
|
||||
summary["message"] = summary["errors"][0]
|
||||
summary["device"] = device_path
|
||||
return summary
|
||||
finally:
|
||||
if mounted_here:
|
||||
with _device_lock:
|
||||
unmount_device(mount_point)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user