Fix async lazy-loading in queue repository
- Add selectinload for episode relationship in get_all() - Prevents MissingGreenlet error during queue initialization - Both series and episode are now eagerly loaded
This commit is contained in:
@@ -610,7 +610,7 @@ class DownloadQueueService:
|
||||
|
||||
Args:
|
||||
db: Database session
|
||||
with_series: Whether to eagerly load series data
|
||||
with_series: Whether to eagerly load series and episode data
|
||||
|
||||
Returns:
|
||||
List of all DownloadQueueItem instances
|
||||
@@ -618,7 +618,11 @@ class DownloadQueueService:
|
||||
query = select(DownloadQueueItem)
|
||||
|
||||
if with_series:
|
||||
query = query.options(selectinload(DownloadQueueItem.series))
|
||||
# Eagerly load both series and episode relationships
|
||||
query = query.options(
|
||||
selectinload(DownloadQueueItem.series),
|
||||
selectinload(DownloadQueueItem.episode)
|
||||
)
|
||||
|
||||
query = query.order_by(
|
||||
DownloadQueueItem.created_at.asc(),
|
||||
|
||||
Reference in New Issue
Block a user