diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c4158ea..97b7e1a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -81,7 +81,8 @@ jobs: with: context: . file: ${{ matrix.dockerfile }} - platforms: linux/amd64,linux/arm64 + # FOR NOW: ARM disabled for faster debugging - re-enable linux/arm64 when stable + platforms: linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/src/lib/server/pcd/cache.ts b/src/lib/server/pcd/cache.ts index ad194df..6f1f326 100644 --- a/src/lib/server/pcd/cache.ts +++ b/src/lib/server/pcd/cache.ts @@ -351,6 +351,13 @@ export function getCache(databaseInstanceId: number): PCDCache | undefined { return caches.get(databaseInstanceId); } +/** + * Get all currently cached database instance IDs (for debugging) + */ +export function getCachedDatabaseIds(): number[] { + return Array.from(caches.keys()); +} + /** * Invalidate a cache (close and remove from registry) */ diff --git a/src/lib/server/sync/qualityProfiles.ts b/src/lib/server/sync/qualityProfiles.ts index e091219..552ddaa 100644 --- a/src/lib/server/sync/qualityProfiles.ts +++ b/src/lib/server/sync/qualityProfiles.ts @@ -13,7 +13,8 @@ import { BaseSyncer, type SyncResult } from './base.ts'; import { arrSyncQueries } from '$db/queries/arrSync.ts'; -import { getCache } from '$pcd/cache.ts'; +import { getCache, getCachedDatabaseIds } from '$pcd/cache.ts'; +import { databaseInstancesQueries } from '$db/queries/databaseInstances.ts'; import { logger } from '$logger/logger.ts'; import type { SyncArrType } from './mappings.ts'; @@ -97,6 +98,21 @@ export class QualityProfileSyncer extends BaseSyncer { const firstSelection = arrSyncQueries.getQualityProfilesSync(this.instanceId).selections[0]; const cache = getCache(firstSelection.databaseId); if (!cache) { + // Debug: gather info about why cache is missing + const cachedIds = getCachedDatabaseIds(); + const dbInstance = databaseInstancesQueries.getById(firstSelection.databaseId); + + await logger.error(`PCD cache not found for database ${firstSelection.databaseId}`, { + source: 'Sync:QualityProfiles', + meta: { + requestedDatabaseId: firstSelection.databaseId, + cachedDatabaseIds: cachedIds, + databaseExists: !!dbInstance, + databaseEnabled: dbInstance?.enabled ?? null, + databaseName: dbInstance?.name ?? null + } + }); + throw new Error(`PCD cache not found for database ${firstSelection.databaseId}`); } const qualityMappings = await getQualityApiMappings(cache, this.instanceType); @@ -147,9 +163,20 @@ export class QualityProfileSyncer extends BaseSyncer { for (const selection of syncConfig.selections) { const cache = getCache(selection.databaseId); if (!cache) { + // Debug: gather info about why cache is missing + const cachedIds = getCachedDatabaseIds(); + const dbInstance = databaseInstancesQueries.getById(selection.databaseId); + await logger.warn(`PCD cache not found for database ${selection.databaseId}`, { source: 'Sync:QualityProfiles', - meta: { instanceId: this.instanceId, databaseId: selection.databaseId } + meta: { + instanceId: this.instanceId, + requestedDatabaseId: selection.databaseId, + cachedDatabaseIds: cachedIds, + databaseExists: !!dbInstance, + databaseEnabled: dbInstance?.enabled ?? null, + databaseName: dbInstance?.name ?? null + } }); continue; }