@belmontdigitalmarketing/n8n-nodes-flowlu 0.3.0 → 0.3.1
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.
|
@@ -38,9 +38,16 @@ function isFlowluRateLimit(value) {
|
|
|
38
38
|
// GET wrapper that retries through Flowlu's rate limit with linear backoff. If it
|
|
39
39
|
// never succeeds it throws, so callers surface the real cause instead of silently
|
|
40
40
|
// returning no data (which previously masqueraded as "No fields found").
|
|
41
|
-
async function flowluApiGetWithRetry(baseUrl, endpoint, apiKey, queryParams, maxRetries =
|
|
41
|
+
async function flowluApiGetWithRetry(baseUrl, endpoint, apiKey, queryParams, maxRetries = 4) {
|
|
42
42
|
let lastMessage = 'Flowlu request failed';
|
|
43
43
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
44
|
+
// Jittered wait before each attempt. The small random delay on the first
|
|
45
|
+
// attempt de-syncs the burst of dropdown loads fired on node-open so they
|
|
46
|
+
// don't hit Flowlu's rate limit in lockstep; later attempts back off longer.
|
|
47
|
+
const wait = attempt === 0 ? Math.floor(Math.random() * 1200) : 1500 * attempt + Math.floor(Math.random() * 1000);
|
|
48
|
+
await new Promise((resolve) => {
|
|
49
|
+
setTimeout(resolve, wait);
|
|
50
|
+
});
|
|
44
51
|
try {
|
|
45
52
|
const response = await flowluApiRequest.call(this, 'GET', baseUrl, endpoint, apiKey, undefined, queryParams);
|
|
46
53
|
if (!isFlowluRateLimit(response?.error ?? response)) {
|
|
@@ -54,12 +61,6 @@ async function flowluApiGetWithRetry(baseUrl, endpoint, apiKey, queryParams, max
|
|
|
54
61
|
}
|
|
55
62
|
lastMessage = error.message || 'Flowlu request limit exceeded';
|
|
56
63
|
}
|
|
57
|
-
// linear backoff before the next attempt (no wait after the final one)
|
|
58
|
-
if (attempt < maxRetries) {
|
|
59
|
-
await new Promise((resolve) => {
|
|
60
|
-
setTimeout(resolve, 1500 * (attempt + 1));
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
64
|
}
|
|
64
65
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Flowlu API rate limit reached while loading data (${lastMessage}). Wait a moment and click Retry.`);
|
|
65
66
|
}
|
package/package.json
CHANGED