Skip to content

Commit

Permalink
Always try at least for number of displays
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucki authored and ifl0w committed Feb 11, 2024
1 parent 46f041b commit 4be2fdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/adapter/genericJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class GenericJsonAdapter extends BaseAdapter {
const authorNameJSONPath = this._settings.getString('author-name-path');
const authorUrlJSONPath = this._settings.getString('author-url-path');

for (let i = 0; i < MAX_ARRAY_RETRIES && wallpaperResult.length < count; i++) {
for (let i = 0; i < MAX_ARRAY_RETRIES + count && wallpaperResult.length < count; i++) {
const [returnObject, resolvedPath] = JSONPath.getTarget(response_body, imageJSONPath);
if (!returnObject || (typeof returnObject !== 'string' && typeof returnObject !== 'number') || returnObject === '')
throw new Error('Unexpected json member found');
Expand Down Expand Up @@ -108,7 +108,7 @@ class GenericJsonAdapter extends BaseAdapter {
async requestRandomImage(count: number) {
const wallpaperResult: HistoryEntry[] = [];

for (let i = 0; i < MAX_SERVICE_RETRIES && wallpaperResult.length < count; i++) {
for (let i = 0; i < MAX_SERVICE_RETRIES + count && wallpaperResult.length < count; i++) {
try {
// This should run sequentially
// eslint-disable-next-line no-await-in-loop
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/unsplash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class UnsplashAdapter extends BaseAdapter {
async requestRandomImage(count: number) {
const wallpaperResult: HistoryEntry[] = [];

for (let i = 0; i < MAX_SERVICE_RETRIES && wallpaperResult.length < count; i++) {
for (let i = 0; i < MAX_SERVICE_RETRIES + count && wallpaperResult.length < count; i++) {
try {
// This should run sequentially
// eslint-disable-next-line no-await-in-loop
Expand Down

0 comments on commit 4be2fdf

Please sign in to comment.