From 3dfb80a2376b439b55588151e094a2d551899b35 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sun, 23 Nov 2025 00:10:14 +0100 Subject: [PATCH] Fix image queue creation --- src/lib/SourceAwareQueue.ts | 10 ++++++---- src/lib/requests/RequestManager.ts | 3 +-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/SourceAwareQueue.ts b/src/lib/SourceAwareQueue.ts index 33bbad11..6cd86bc0 100644 --- a/src/lib/SourceAwareQueue.ts +++ b/src/lib/SourceAwareQueue.ts @@ -12,14 +12,16 @@ import { Sources } from '@/features/source/services/Sources.ts'; export class SourceAwareQueue { private static readonly DEFAULT_ID = '__global__'; - private readonly queueBySource = new Map([ - [SourceAwareQueue.DEFAULT_ID, new Queue(this.concurrencyPerSource)], - ]); + private readonly queueBySource: Map; constructor( private readonly areConnectionsLimited: boolean, private readonly concurrencyPerSource = 5, - ) {} + ) { + this.queueBySource = new Map([ + [SourceAwareQueue.DEFAULT_ID, new Queue(this.concurrencyPerSource)], + ]); + } private getConcurrencyFor(sourceId: string | null): number { const isLocalSource = sourceId === Sources.LOCAL_SOURCE_ID; diff --git a/src/lib/requests/RequestManager.ts b/src/lib/requests/RequestManager.ts index dfc99818..c02a160d 100644 --- a/src/lib/requests/RequestManager.ts +++ b/src/lib/requests/RequestManager.ts @@ -467,7 +467,7 @@ export class RequestManager { const isHttps = typeof window !== 'undefined' && window.location.protocol === 'https:'; const isHttp2 = isHttps && this.detectHttp2(); - this.imageQueue = new SourceAwareQueue(isHttp2, 5); + this.imageQueue = new SourceAwareQueue(!isHttp2, 5); BaseClient.setTokenRefreshCompleteCallback(() => { this.processQueues(); @@ -954,7 +954,6 @@ export class RequestManager { private getSourceIdFromUrl(url: string): string | null { try { - console.log('asdf', new URL(url).searchParams.get('sourceId')); return new URL(url).searchParams.get('sourceId'); } catch { return null;