From 12caa7fbdee1c589f749ce8e44ca4f49be735431 Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 9 Nov 2026 11:08:54 +0100 Subject: [PATCH] fix(synology): an unreachable library is reported, not asked a second time for the next id --- server/src/nest/memories/synology.service.ts | 4 +++- server/tests/unit/nest/synology.service.test.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/server/src/nest/memories/synology.service.ts b/server/src/nest/memories/synology.service.ts index 1f06fb42d..362b133f6 100644 --- a/server/src/nest/memories/synology.service.ts +++ b/server/src/nest/memories/synology.service.ts @@ -741,8 +741,10 @@ export class SynologyService { // counts: never a neighbour's capture time or GPS. const unit = Number(parsedId.id); const own = await this._readItemOfUnit(targetUserId, unit, parsedId.id, passphrase); + // The neighbour only when the library answered with another photo: a failed + // call (an unreachable NAS) is passed on, not repeated against the next id. const found = - own.success && own.data ? own : await this._readItemOfUnit(targetUserId, unit + 1, parsedId.id, passphrase); + own.success && !own.data ? await this._readItemOfUnit(targetUserId, unit + 1, parsedId.id, passphrase) : own; if (!found.success) return found as ServiceResult; if (!found.data) return fail('Photo not found', 404); diff --git a/server/tests/unit/nest/synology.service.test.ts b/server/tests/unit/nest/synology.service.test.ts index cdf12168d..f5976cfff 100644 --- a/server/tests/unit/nest/synology.service.test.ts +++ b/server/tests/unit/nest/synology.service.test.ts @@ -581,6 +581,15 @@ describe('getSynologyAssetInfo', () => { expect(requestedIds()).toEqual(['[10314]']); }); + it('SYNO-U095: passes a failed call on instead of asking the next id of an unreachable library', async () => { + safeFetch.mockResolvedValueOnce(httpError(503)); + + const result = await svc.getSynologyAssetInfo(USER, '10314_1793757217', USER); + + expect(result.success).toBe(false); + expect(requestedIds()).toEqual(['[10314]']); + }); + it('SYNO-U094: asks for the thumbnail with the metadata, the only way to tell which photo answered', async () => { safeFetch.mockResolvedValueOnce(item('10314_1793757217', 1718236800));