fix(synology): an unreachable library is reported, not asked a second time for the next id

This commit is contained in:
Maurice
2026-11-09 11:08:54 +01:00
parent 1cbd4acf01
commit 12caa7fbde
2 changed files with 12 additions and 1 deletions
+3 -1
View File
@@ -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<AssetInfo>;
if (!found.data) return fail('Photo not found', 404);
@@ -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));