Saving the final changes for the night.

This commit is contained in:
Scott Idem
2025-12-15 19:07:06 -05:00
parent 0169cd5fcd
commit f403a3dd59
2 changed files with 32 additions and 4 deletions

View File

@@ -96,6 +96,11 @@ export const post_object = async function post_object({
for (let attempt = 1; attempt <= retry_count; attempt++) {
try {
const controller = new AbortController();
const timeoutId = setTimeout(() => {
console.error('API POST request timed out.');
controller.abort();
}, 20000); // 20-second timeout
const fetchOptions: RequestInit = {
method: 'POST',
headers: headers_cleaned,
@@ -108,6 +113,7 @@ export const post_object = async function post_object({
}
const response = await fetch(url.toString(), fetchOptions);
clearTimeout(timeoutId); // Clear the timeout if the request completes in time
if (log_lvl) {
console.log(`Response: status=${response.status} attempt=${attempt}`);