From 2635c196675bc624255506551d9ea21c5e70e907 Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Sat, 29 Mar 2025 07:52:49 +0100 Subject: [PATCH] fix: improve HTTP client configuration and clear update documents after API calls --- src/api.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/api.cpp b/src/api.cpp index d15b273..d67d2ed 100644 --- a/src/api.cpp +++ b/src/api.cpp @@ -94,6 +94,9 @@ void sendToApi(void *parameter) { String octoToken = params->octoToken; HTTPClient http; + http.setReuse(false); + http.setTimeout(10000); + http.begin(spoolsUrl); http.addHeader("Content-Type", "application/json"); if (octoEnabled && octoToken != "") http.addHeader("X-Api-Key", octoToken); @@ -111,6 +114,7 @@ void sendToApi(void *parameter) { } http.end(); + vTaskDelay(50 / portTICK_PERIOD_MS); // Speicher freigeben delete params; @@ -165,6 +169,8 @@ bool updateSpoolTagId(String uidString, const char* payload) { NULL // Task-Handle (nicht benötigt) ); + updateDoc.clear(); + return true; } @@ -201,6 +207,8 @@ uint8_t updateSpoolWeight(String spoolId, uint16_t weight) { NULL // Task-Handle (nicht benötigt) ); + updateDoc.clear(); + return 1; } @@ -238,6 +246,8 @@ bool updateSpoolOcto(int spoolId) { NULL // Task-Handle (nicht benötigt) ); + updateDoc.clear(); + return true; }