Fix sync stuck at 80% — serialize datetime in SyncResult for WebSocket emit
This commit is contained in:
parent
49d1cb595f
commit
9557e6bdd3
2 changed files with 10 additions and 2 deletions
|
|
@ -24912,11 +24912,16 @@ def _run_sync_task(playlist_id, playlist_name, tracks_json, automation_id=None):
|
||||||
print(f" Result details: matched={getattr(result, 'matched_tracks', 'N/A')}, total={getattr(result, 'total_tracks', 'N/A')}")
|
print(f" Result details: matched={getattr(result, 'matched_tracks', 'N/A')}, total={getattr(result, 'total_tracks', 'N/A')}")
|
||||||
|
|
||||||
# Update final state on completion
|
# Update final state on completion
|
||||||
|
# Convert result to JSON-serializable dict (datetime/errors can't be emitted via SocketIO)
|
||||||
|
result_dict = {
|
||||||
|
k: (v.isoformat() if hasattr(v, 'isoformat') else v)
|
||||||
|
for k, v in result.__dict__.items()
|
||||||
|
}
|
||||||
with sync_lock:
|
with sync_lock:
|
||||||
sync_states[playlist_id] = {
|
sync_states[playlist_id] = {
|
||||||
"status": "finished",
|
"status": "finished",
|
||||||
"progress": result.__dict__, # Store result as progress for status endpoint compatibility
|
"progress": result_dict,
|
||||||
"result": result.__dict__ # Keep result for backward compatibility
|
"result": result_dict
|
||||||
}
|
}
|
||||||
print(f"🏁 Sync finished for {playlist_id} - state updated")
|
print(f"🏁 Sync finished for {playlist_id} - state updated")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// Disable particles on mobile devices for performance
|
||||||
|
if (window.innerWidth <= 768 || /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent)) return;
|
||||||
|
|
||||||
const canvas = document.getElementById('page-particles-canvas');
|
const canvas = document.getElementById('page-particles-canvas');
|
||||||
if (!canvas) return;
|
if (!canvas) return;
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue