mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 19:01:06 -05:00
Fixed the TypeError in _periodic_cleanup by adding runtime type checking and conversion:
Added checks to ensure added_at is always a datetime object before comparison Converts string timestamps to datetime objects when needed Implemented proper datetime serialization/deserialization in QueueItem: to_dict method properly converts datetime objects to ISO format strings from_dict method properly converts ISO format strings back to datetime objects Added datetime handling for all datetime fields: added_at last_retry last_error_time
This commit is contained in:
@@ -655,12 +655,18 @@ class EnhancedVideoQueueManager:
|
||||
# Clean up completed items
|
||||
for url in list(self._completed.keys()):
|
||||
item = self._completed[url]
|
||||
# Ensure added_at is a datetime object
|
||||
if isinstance(item.added_at, str):
|
||||
item.added_at = datetime.fromisoformat(item.added_at)
|
||||
if item.added_at < cleanup_cutoff:
|
||||
self._completed.pop(url)
|
||||
|
||||
# Clean up failed items
|
||||
for url in list(self._failed.keys()):
|
||||
item = self._failed[url]
|
||||
# Ensure added_at is a datetime object
|
||||
if isinstance(item.added_at, str):
|
||||
item.added_at = datetime.fromisoformat(item.added_at)
|
||||
if item.added_at < cleanup_cutoff:
|
||||
self._failed.pop(url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user