Usenet streaming with a WebDAV server and a SABnzbd-compatible API
C#
Improved queue api performance.
nzbdav-devafd5248e0748
diff --git a/backend/Api/SabControllers/AddFile/AddFileController.cs b/backend/Api/SabControllers/AddFile/AddFileController.csindex e1006190..8702c2ab 100644--- a/backend/Api/SabControllers/AddFile/AddFileController.cs+++ b/backend/Api/SabControllers/AddFile/AddFileController.cs@@ -35,7 +35,6 @@ public class AddFileController(CreatedAt = DateTime.Now,FileName = request.FileName,JobName = Path.GetFileNameWithoutExtension(request.FileName),- NzbContents = nzbFileContents,NzbFileSize = documentBytes.Length,TotalSegmentBytes = document.Files.SelectMany(x => x.Segments).Select(x => x.Size).Sum(),Category = request.Category,@@ -43,7 +42,13 @@ public class AddFileController(PostProcessing = request.PostProcessing,PauseUntil = request.PauseUntil};+ var queueNzbContents = new QueueNzbContents()+ {+ Id = queueItem.Id,+ NzbContents = nzbFileContents,+ };dbClient.Ctx.QueueItems.Add(queueItem);+ dbClient.Ctx.QueueNzbContents.Add(queueNzbContents);await dbClient.Ctx.SaveChangesAsync(request.CancellationToken);var message = GetQueueResponse.QueueSlot.FromQueueItem(queueItem).ToJson();_ = websocketManager.SendMessage(WebsocketTopic.QueueItemAdded, message);diff --git a/backend/Database/DavDatabaseClient.cs b/backend/Database/DavDatabaseClient.csindex dc2d76e3..ca058bc5 100644--- a/backend/Database/DavDatabaseClient.cs+++ b/backend/Database/DavDatabaseClient.cs@@ -76,16 +76,23 @@ public sealed class DavDatabaseClient(DavDatabaseContext ctx)}// queue- public Task<QueueItem?> GetTopQueueItem(CancellationToken ct = default)+ public async Task<(QueueItem? queueItem, QueueNzbContents? queueNzbContents)> GetTopQueueItem+ (+ CancellationToken ct = default+ ){var nowTime = DateTime.Now;- return Ctx.QueueItems+ var queueItem = await Ctx.QueueItems.OrderByDescending(q => q.Priority).ThenBy(q => q.CreatedAt).Where(q => q.PauseUntil == null || nowTime >= q.PauseUntil).Skip(0).Take(1).FirstOrDefaultAsync(ct);+ var queueNzbContents = queueItem != null+ ? await Ctx.QueueNzbContents.FirstOrDefaultAsync(q => q.Id == queueItem.Id, ct)+ : null;+ return (queueItem, queueNzbContents);}public Task<QueueItem[]> GetQueueItems@@ -96,24 +103,14 @@ public sealed class DavDatabaseClient(DavDatabaseContext ctx)CancellationToken ct = default){- return Ctx.QueueItems- .Where(q => q.Category == category || category == null)+ var queueItems = category != null+ ? Ctx.QueueItems.Where(q => q.Category == category)+ : Ctx.QueueItems;+ return queueItems.OrderByDescending(q => q.Priority).ThenBy(q => q.CreatedAt).Skip(start).Take(limit)- .Select(q => new QueueItem()- {- Id = q.Id,- CreatedAt = q.CreatedAt,- FileName = q.FileName,- NzbContents = null!,- NzbFileSize = q.NzbFileSize,- TotalSegmentBytes = q.TotalSegmentBytes,- Category = q.Category,- Priority = q.Priority,- PostProcessing = q.PostProcessing,- }).ToArrayAsync(cancellationToken: ct);}diff --git a/backend/Database/DavDatabaseContext.cs b/backend/Database/DavDatabaseContext.csindex 32fa05eb..846f0499 100644--- a/backend/Database/DavDatabaseContext.cs+++ b/backend/Database/DavDatabaseContext.cs@@ -26,6 +26,7 @@ public sealed class DavDatabaseContext() : DbContext(Options.Value)public DbSet<DavMultipartFile> MultipartFiles => Set<DavMultipartFile>();public DbSet<QueueItem> QueueItems => Set<QueueItem>();public DbSet<HistoryItem> HistoryItems => Set<HistoryItem>();+ public DbSet<QueueNzbContents> QueueNzbContents => Set<QueueNzbContents>();public DbSet<HealthCheckResult> HealthCheckResults => Set<HealthCheckResult>();public DbSet<ConfigItem> ConfigItems => Set<ConfigItem>();@@ -204,9 +205,6 @@ public sealed class DavDatabaseContext() : DbContext(Options.Value)e.Property(i => i.FileName).IsRequired();- e.Property(i => i.NzbContents)- .IsRequired();-e.Property(i => i.NzbFileSize).IsRequired();@@ -299,6 +297,24 @@ public sealed class DavDatabaseContext() : DbContext(Options.Value)e.HasIndex(i => new { i.Category, i.DownloadDirId }).IsUnique(false);});++ // QueueNzbContents+ b.Entity<QueueNzbContents>(e =>+ {+ e.ToTable("QueueNzbContents");+ e.HasKey(i => i.Id);++ e.Property(i => i.Id)+ .ValueGeneratedNever();++ e.Property(i => i.NzbContents)+ .IsRequired();++ e.HasOne(f => f.QueueItem)+ .WithOne()+ .HasForeignKey<QueueNzbContents>(f => f.Id)+ .OnDelete(DeleteBehavior.Cascade);+ });// HealthCheckResultb.Entity<HealthCheckResult>(e =>diff --git a/backend/Database/Migrations/20251030163510_Add-QueueNzbContents-Table.Designer.cs b/backend/Database/Migrations/20251030163510_Add-QueueNzbContents-Table.Designer.csnew file mode 100644index 00000000..59094350--- /dev/null+++ b/backend/Database/Migrations/20251030163510_Add-QueueNzbContents-Table.Designer.cs@@ -0,0 +1,362 @@+// <auto-generated />+using System;+using Microsoft.EntityFrameworkCore;+using Microsoft.EntityFrameworkCore.Infrastructure;+using Microsoft.EntityFrameworkCore.Migrations;+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;+using NzbWebDAV.Database;++#nullable disable++namespace NzbWebDAV.Database.Migrations+{+ [DbContext(typeof(DavDatabaseContext))]+ [Migration("20251030163510_Add-QueueNzbContents-Table")]+ partial class AddQueueNzbContentsTable+ {+ /// <inheritdoc />+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "9.0.4");++ modelBuilder.Entity("NzbWebDAV.Database.Models.Account", b =>+ {+ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.Property<string>("Username")+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<string>("PasswordHash")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("RandomSalt")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Type", "Username");++ b.ToTable("Accounts", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.ConfigItem", b =>+ {+ b.Property<string>("ConfigName")+ .HasColumnType("TEXT");++ b.Property<string>("ConfigValue")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("ConfigName");++ b.ToTable("ConfigItems", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavItem", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<long?>("FileSize")+ .HasColumnType("INTEGER");++ b.Property<string>("IdPrefix")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long?>("LastHealthCheck")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<long?>("NextHealthCheck")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("ParentId")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long?>("ReleaseDate")+ .HasColumnType("INTEGER");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("IdPrefix", "Type");++ b.HasIndex("ParentId", "Name")+ .IsUnique();++ b.HasIndex("Type", "NextHealthCheck", "ReleaseDate", "Id");++ b.ToTable("DavItems", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavMultipartFile", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("Metadata")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("DavMultipartFiles", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavNzbFile", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("SegmentIds")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("DavNzbFiles", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavRarFile", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("RarParts")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("DavRarFiles", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.HealthCheckResult", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<long>("CreatedAt")+ .HasColumnType("INTEGER");++ b.Property<Guid>("DavItemId")+ .HasColumnType("TEXT");++ b.Property<string>("Message")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<int>("RepairStatus")+ .HasColumnType("INTEGER");++ b.Property<int>("Result")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("DavItemId")+ .HasFilter("\"RepairStatus\" = 3");++ b.HasIndex("Result", "RepairStatus", "CreatedAt");++ b.ToTable("HealthCheckResults", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.HistoryItem", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("Category")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<Guid?>("DownloadDirId")+ .HasColumnType("TEXT");++ b.Property<int>("DownloadStatus")+ .HasColumnType("INTEGER");++ b.Property<int>("DownloadTimeSeconds")+ .HasColumnType("INTEGER");++ b.Property<string>("FailMessage")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("JobName")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long>("TotalSegmentBytes")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("Category");++ b.HasIndex("CreatedAt");++ b.HasIndex("Category", "CreatedAt");++ b.HasIndex("Category", "DownloadDirId");++ b.ToTable("HistoryItems", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.QueueItem", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("Category")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<DateTime>("CreatedAt")+ .HasColumnType("TEXT");++ b.Property<string>("FileName")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("JobName")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long>("NzbFileSize")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("PauseUntil")+ .HasColumnType("TEXT");++ b.Property<int>("PostProcessing")+ .HasColumnType("INTEGER");++ b.Property<int>("Priority")+ .HasColumnType("INTEGER");++ b.Property<long>("TotalSegmentBytes")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("Category");++ b.HasIndex("CreatedAt");++ b.HasIndex("FileName")+ .IsUnique();++ b.HasIndex("Priority");++ b.HasIndex("Priority", "CreatedAt");++ b.HasIndex("Category", "Priority", "CreatedAt");++ b.ToTable("QueueItems", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.QueueNzbContents", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("NzbContents")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("QueueNzbContents", (string)null);+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavItem", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.DavItem", "Parent")+ .WithMany("Children")+ .HasForeignKey("ParentId")+ .OnDelete(DeleteBehavior.Cascade);++ b.Navigation("Parent");+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavMultipartFile", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.DavItem", "DavItem")+ .WithOne()+ .HasForeignKey("NzbWebDAV.Database.Models.DavMultipartFile", "Id")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("DavItem");+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavNzbFile", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.DavItem", "DavItem")+ .WithOne()+ .HasForeignKey("NzbWebDAV.Database.Models.DavNzbFile", "Id")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("DavItem");+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavRarFile", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.DavItem", "DavItem")+ .WithOne()+ .HasForeignKey("NzbWebDAV.Database.Models.DavRarFile", "Id")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("DavItem");+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.QueueNzbContents", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.QueueItem", "QueueItem")+ .WithOne()+ .HasForeignKey("NzbWebDAV.Database.Models.QueueNzbContents", "Id")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("QueueItem");+ });++ modelBuilder.Entity("NzbWebDAV.Database.Models.DavItem", b =>+ {+ b.Navigation("Children");+ });+#pragma warning restore 612, 618+ }+ }+}diff --git a/backend/Database/Migrations/20251030163510_Add-QueueNzbContents-Table.cs b/backend/Database/Migrations/20251030163510_Add-QueueNzbContents-Table.csnew file mode 100644index 00000000..b4c29736--- /dev/null+++ b/backend/Database/Migrations/20251030163510_Add-QueueNzbContents-Table.cs@@ -0,0 +1,70 @@+using System;+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace NzbWebDAV.Database.Migrations+{+ /// <inheritdoc />+ public partial class AddQueueNzbContentsTable : Migration+ {+ /// <inheritdoc />+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.CreateTable(+ name: "QueueNzbContents",+ columns: table => new+ {+ Id = table.Column<Guid>(type: "TEXT", nullable: false),+ NzbContents = table.Column<string>(type: "TEXT", nullable: false)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_QueueNzbContents", x => x.Id);+ table.ForeignKey(+ name: "FK_QueueNzbContents_QueueItems_Id",+ column: x => x.Id,+ principalTable: "QueueItems",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ // Copy existing NzbContents from QueueItems to QueueNzbContents+ migrationBuilder.Sql(@"+ INSERT INTO QueueNzbContents (Id, NzbContents)+ SELECT Id, NzbContents FROM QueueItems+ WHERE NzbContents IS NOT NULL+ ");+++ migrationBuilder.DropColumn(+ name: "NzbContents",+ table: "QueueItems");+ }++ /// <inheritdoc />+ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.AddColumn<string>(+ name: "NzbContents",+ table: "QueueItems",+ type: "TEXT",+ nullable: false,+ defaultValue: "");++ // Populate the re-introduced column from QueueNzbContents+ migrationBuilder.Sql(@"+ UPDATE QueueItems+ SET NzbContents = (+ SELECT q.NzbContents+ FROM QueueNzbContents q+ WHERE q.Id = QueueItems.Id+ )+ WHERE Id IN (SELECT Id FROM QueueNzbContents);+ ");++ migrationBuilder.DropTable(+ name: "QueueNzbContents");+ }+ }+}diff --git a/backend/Database/Migrations/DavDatabaseContextModelSnapshot.cs b/backend/Database/Migrations/DavDatabaseContextModelSnapshot.csindex ef2015d7..57062c61 100644--- a/backend/Database/Migrations/DavDatabaseContextModelSnapshot.cs+++ b/backend/Database/Migrations/DavDatabaseContextModelSnapshot.cs@@ -248,10 +248,6 @@ namespace NzbWebDAV.Database.Migrations.IsRequired().HasColumnType("TEXT");- b.Property<string>("NzbContents")- .IsRequired()- .HasColumnType("TEXT");-b.Property<long>("NzbFileSize").HasColumnType("INTEGER");@@ -285,6 +281,20 @@ namespace NzbWebDAV.Database.Migrationsb.ToTable("QueueItems", (string)null);});+ modelBuilder.Entity("NzbWebDAV.Database.Models.QueueNzbContents", b =>+ {+ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("NzbContents")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.ToTable("QueueNzbContents", (string)null);+ });+modelBuilder.Entity("NzbWebDAV.Database.Models.DavItem", b =>{b.HasOne("NzbWebDAV.Database.Models.DavItem", "Parent")@@ -328,6 +338,17 @@ namespace NzbWebDAV.Database.Migrationsb.Navigation("DavItem");});+ modelBuilder.Entity("NzbWebDAV.Database.Models.QueueNzbContents", b =>+ {+ b.HasOne("NzbWebDAV.Database.Models.QueueItem", "QueueItem")+ .WithOne()+ .HasForeignKey("NzbWebDAV.Database.Models.QueueNzbContents", "Id")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("QueueItem");+ });+modelBuilder.Entity("NzbWebDAV.Database.Models.DavItem", b =>{b.Navigation("Children");diff --git a/backend/Database/Models/QueueItem.cs b/backend/Database/Models/QueueItem.csindex 8d287fa6..c30d4c6b 100644--- a/backend/Database/Models/QueueItem.cs+++ b/backend/Database/Models/QueueItem.cs@@ -6,7 +6,6 @@ public class QueueItempublic DateTime CreatedAt { get; set; }public string FileName { get; set; } = null!;public string JobName { get; set; } = null!;- public string NzbContents { get; set; } = null!;public long NzbFileSize { get; set; }public long TotalSegmentBytes { get; set; }public string Category { get; set; } = null!;diff --git a/backend/Database/Models/QueueNzbContents.cs b/backend/Database/Models/QueueNzbContents.csnew file mode 100644index 00000000..92f6f626--- /dev/null+++ b/backend/Database/Models/QueueNzbContents.cs@@ -0,0 +1,10 @@+namespace NzbWebDAV.Database.Models;++public class QueueNzbContents+{+ public Guid Id { get; set; }+ public string NzbContents { get; set; } = null!;++ // navigation helpers+ public QueueItem? QueueItem { get; set; }+}\ No newline at end of filediff --git a/backend/Queue/QueueItemProcessor.cs b/backend/Queue/QueueItemProcessor.csindex 5733843e..43775b8d 100644--- a/backend/Queue/QueueItemProcessor.cs+++ b/backend/Queue/QueueItemProcessor.cs@@ -23,6 +23,7 @@ namespace NzbWebDAV.Queue;public class QueueItemProcessor(QueueItem queueItem,+ QueueNzbContents queueNzbContents,DavDatabaseClient dbClient,UsenetStreamingClient usenetClient,ConfigManager configManager,@@ -109,7 +110,7 @@ public class QueueItemProcessor(using var _ = ct.SetScopedContext(new ReservedConnectionsContext(reservedConnections));// read the nzb document- var documentBytes = Encoding.UTF8.GetBytes(queueItem.NzbContents);+ var documentBytes = Encoding.UTF8.GetBytes(queueNzbContents.NzbContents);using var stream = new MemoryStream(documentBytes);var nzb = await NzbDocument.LoadAsync(stream);var archivePassword = nzb.MetaData.GetValueOrDefault("password")?.FirstOrDefault();diff --git a/backend/Queue/QueueManager.cs b/backend/Queue/QueueManager.csindex ee1c245b..f6e98397 100644--- a/backend/Queue/QueueManager.cs+++ b/backend/Queue/QueueManager.cs@@ -68,8 +68,8 @@ public class QueueManager : IDisposable// get the next queue-item from the databaseawait using var dbContext = new DavDatabaseContext();var dbClient = new DavDatabaseClient(dbContext);- var queueItem = await LockAsync(() => dbClient.GetTopQueueItem(ct));- if (queueItem is null)+ var topItem = await LockAsync(() => dbClient.GetTopQueueItem(ct));+ if (topItem.queueItem is null || topItem.queueNzbContents is null){// if we're done with the queue, wait// five seconds before checking again.@@ -82,7 +82,7 @@ public class QueueManager : IDisposableawait LockAsync(() =>{_inProgressQueueItem = BeginProcessingQueueItem(- dbClient, queueItem, queueItemCancellationTokenSource+ dbClient, topItem.queueItem, topItem.queueNzbContents, queueItemCancellationTokenSource);});await (_inProgressQueueItem?.ProcessingTask ?? Task.CompletedTask);@@ -102,12 +102,14 @@ public class QueueManager : IDisposable(DavDatabaseClient dbClient,QueueItem queueItem,+ QueueNzbContents queueNzbContents,CancellationTokenSource cts){var progressHook = new Progress<int>();var task = new QueueItemProcessor(- queueItem, dbClient, _usenetClient, _configManager, _websocketManager, progressHook, cts.Token+ queueItem, queueNzbContents, dbClient, _usenetClient,+ _configManager, _websocketManager, progressHook, cts.Token).ProcessAsync();var inProgressQueueItem = new InProgressQueueItem(){diff --git a/backend/WebDav/DatabaseStoreQueueItem.cs b/backend/WebDav/DatabaseStoreQueueItem.csindex f3e2be47..ae8353e6 100644--- a/backend/WebDav/DatabaseStoreQueueItem.cs+++ b/backend/WebDav/DatabaseStoreQueueItem.cs@@ -11,7 +11,6 @@ public class DatabaseStoreQueueItem(DavDatabaseClient dbClient) : BaseStoreReadonlyItem{- public QueueItem QueueItem => queueItem;public override string Name => queueItem.FileName;public override string UniqueKey => queueItem.Id.ToString();public override long FileSize => queueItem.NzbFileSize;@@ -20,7 +19,7 @@ public class DatabaseStoreQueueItem(public override async Task<Stream> GetReadableStreamAsync(CancellationToken ct){var id = queueItem.Id;- var document = await dbClient.Ctx.QueueItems.Where(x => x.Id == id).FirstOrDefaultAsync(ct);+ var document = await dbClient.Ctx.QueueNzbContents.Where(x => x.Id == id).FirstOrDefaultAsync(ct);if (document is null) throw new FileNotFoundException($"Could not find nzb document with id: {id}");return new MemoryStream(Encoding.UTF8.GetBytes(document.NzbContents));}