Saving the final changes for the night.
This commit is contained in:
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user