From 5eb4cbfeb0a1f93d0e7de4e614d36ada35517c5c Mon Sep 17 00:00:00 2001 From: dekzter Date: Thu, 20 Mar 2025 17:03:46 -0400 Subject: [PATCH] added 'starting' notification for refresh, fixed typo --- apps/m3u/tasks.py | 4 ++-- frontend/src/components/M3URefreshNotification.jsx | 3 ++- frontend/src/components/tables/M3UsTable.jsx | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/m3u/tasks.py b/apps/m3u/tasks.py index 01787cf1..5d3e1455 100644 --- a/apps/m3u/tasks.py +++ b/apps/m3u/tasks.py @@ -23,7 +23,7 @@ from asgiref.sync import async_to_sync logger = logging.getLogger(__name__) LOCK_EXPIRE = 300 -BATCH_SIZE = 10000 +BATCH_SIZE = 1000 SKIP_EXTS = {} def fetch_m3u_lines(account): @@ -230,7 +230,7 @@ def process_m3u_batch(account_id, batch, group_names, hash_keys): obj.last_seen = timezone.now() if changed: streams_to_update.append(obj) - del existig_streams[stream_hash] + del existing_streams[stream_hash] else: existing_streams[stream_hash] = obj else: diff --git a/frontend/src/components/M3URefreshNotification.jsx b/frontend/src/components/M3URefreshNotification.jsx index 34d50daf..6c2fc3fb 100644 --- a/frontend/src/components/M3URefreshNotification.jsx +++ b/frontend/src/components/M3URefreshNotification.jsx @@ -21,6 +21,7 @@ export default function M3URefreshNotification() { const playlist = playlists.find((pl) => pl.id == id); if (!progress[id]) { if (refreshProgress[id] == 100) { + // This situation is if it refreshes so fast we only get the 100% complete notification const notificationId = notifications.show({ loading: false, title: `M3U Refresh: ${playlist.name}`, @@ -38,7 +39,7 @@ export default function M3URefreshNotification() { const notificationId = notifications.show({ loading: true, title: `M3U Refresh: ${playlist.name}`, - message: `Updating M3U: ${refreshProgress[id]}%`, + message: `Starting...`, autoClose: false, withCloseButton: false, }); diff --git a/frontend/src/components/tables/M3UsTable.jsx b/frontend/src/components/tables/M3UsTable.jsx index 3b2956e5..82bbee9d 100644 --- a/frontend/src/components/tables/M3UsTable.jsx +++ b/frontend/src/components/tables/M3UsTable.jsx @@ -45,7 +45,7 @@ const Example = () => { const [rowSelection, setRowSelection] = useState([]); const [activeFilterValue, setActiveFilterValue] = useState('all'); - const playlists = usePlaylistsStore((state) => state.playlists); + const { playlists, setRefreshProgress } = usePlaylistsStore(); const theme = useMantineTheme(); @@ -109,6 +109,7 @@ const Example = () => { const refreshPlaylist = async (id) => { await API.refreshPlaylist(id); + setRefreshProgress(id, 0); }; const deletePlaylist = async (id) => {