Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ describe('Temporary API Key Service', function () {
['{}', { status: 200 }],
[JSON.stringify({ key: '12345' }), { status: 200 }],
);
await service.fetchTemporaryApiKey();
let temporaryKey = await service.fetchTemporaryApiKey();
expect(temporaryKey).toEqual('12345');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class TemporaryApiKeyService {
)}`,
);
}
return key;
} catch (e) {
console.error(
'[Qminder API]: Failed to parse the temporary API key response',
Expand All @@ -68,12 +69,7 @@ export class TemporaryApiKeyService {

private async retry(retryCount = 0): Promise<string> {
const timeOutMs = Math.min(60000, Math.max(5000, 2 ** retryCount * 1000));
const timeOutSec = timeOutMs / 1000;
console.info(
`[Qminder API]: Retrying to fetch API key in ${
timeOutSec / 1000
} seconds`,
);
console.info(`[Qminder API]: Retrying to fetch API key in ${timeOutMs} ms`);
await sleepMs(timeOutMs);
return this.fetchTemporaryApiKey(retryCount + 1);
}
Expand Down
Loading