PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | src/PageCreator/lib/processPatterns.js +8 -2 3.1.2 → trunk View file →
@@ -1,6 +1,8 @@
1 1 import { getActivePlugins, processPlaceholders } from '@page-creator/api/WPApi';
2 2 import { recordPluginActivity } from '@shared/api/DataApi';
3 +import { failedDependencies } from '@shared/lib/patterns';
4 +import { sleep } from '@shared/lib/utils';
3 5
4 6 export const processPatterns = async (patterns) => {
5 7 const maxAttempts = 3;
6 8 const delay = 1000; // 1 second delay between retries
@@ -21,9 +23,12 @@
21 23 }
22 24
23 25 for (let attempt = 1; attempt <= maxAttempts; attempt++) {
24 26 try {
25 - return await processPlaceholders(patterns);
27 + const processed = await processPlaceholders(patterns);
28 + if (!failedDependencies(processed).length || attempt === maxAttempts) {
29 + return processed;
30 + }
26 31 } catch (error) {
27 32 if (attempt === maxAttempts) {
28 33 console.error(
29 34 `Failed to process patterns after ${maxAttempts} attempts:`,
@@ -30,8 +35,9 @@
30 35 error,
31 36 );
32 37 return patterns;
33 38 }
34 - await new Promise((resolve) => setTimeout(resolve, delay));
35 39 }
40 +
41 + await sleep(delay);
36 42 }
37 43 };