Files
ai-news-writer/src/publisher/wp-http-options.js
T
Maria Papoila b0d493d2ff
ai-news-writer-ci / test (pull_request) Failing after 30s
ci: Gitea Actions pipeline for ai-news-writer (BIT-3394)
Align workflow with BIT-2731: lint, npm test under c8 with lcov, upload
coverage artifact, optional Codecov via repository secret. Document
branch protection and forge URLs in README; ignore coverage output.

Fix ESLint (auto-fix plus strict equality) so the lint job is green.
Disable c8 global check-coverage until overall line coverage catches up;
reports and artifacts remain for Codecov and local review.

Signed-off-by: Maria Papoila <[email protected]>
2026-04-15 02:30:08 +00:00

36 lines
707 B
JavaScript

'use strict';
function wpHttpMaxAttempts() {
const raw = process.env.WP_HTTP_MAX_ATTEMPTS;
if (raw === undefined || raw === '') {
return 3;
}
const n = parseInt(raw, 10);
if (!Number.isFinite(n)) {
return 3;
}
return Math.min(5, Math.max(1, n));
}
function wpRetryBaseMs() {
const raw = process.env.WP_RETRY_BASE_MS;
if (raw === undefined || raw === '') {
return 500;
}
const n = parseInt(raw, 10);
if (!Number.isFinite(n)) {
return 500;
}
return Math.min(30000, Math.max(200, n));
}
function wpRetryOpts() {
return {
maxAttempts: wpHttpMaxAttempts(),
baseDelayMs: wpRetryBaseMs(),
logLabel: 'WordPress'
};
}
module.exports = { wpRetryOpts };