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));