nodebb-plugin-ezoic-infinite 1.4.19 → 1.4.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/client.js +19 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.19",
3
+ "version": "1.4.20",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -429,8 +429,18 @@
429
429
  continue;
430
430
  }
431
431
 
432
+ // Skip si déjà blacklisté
433
+ if (state.badIds && state.badIds.has(id)) {
434
+ state.retryById.delete(id);
435
+ continue;
436
+ }
437
+
432
438
  const tries = (state.retryById.get(id) || 0);
433
- if (tries >= 3) { state.badIds && state.badIds.add(id); continue; }
439
+ if (tries >= 3) {
440
+ state.badIds && state.badIds.add(id);
441
+ state.retryById.delete(id);
442
+ continue;
443
+ }
434
444
 
435
445
  const r = safeRect(wrap);
436
446
  if (r && (r.top > window.innerHeight + 1200 || r.bottom < -1200)) continue;
@@ -440,7 +450,14 @@
440
450
  scheduledAny = true;
441
451
  }
442
452
 
443
- if (scheduledAny) scheduleRefill(700);
453
+ // Ne re-scheduler que si au moins un ID a été enqueued ET qu'il reste des IDs non-blacklistés
454
+ if (scheduledAny) {
455
+ const totalPoolSize = state.poolTopics.length + state.poolPosts.length + state.poolCategories.length +
456
+ state.usedTopics.size + state.usedPosts.size + state.usedCategories.size;
457
+ if (totalPoolSize === 0 || state.badIds.size < totalPoolSize) {
458
+ scheduleRefill(700);
459
+ }
460
+ }
444
461
  }
445
462
 
446
463
  function callShowAdsWhenReady(id) {