mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 19:40:34 +00:00
fix(synology): an unreachable library is reported, not asked a second time for the next id
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user