possibly fix recurring backend timeout

This commit is contained in:
Lion Kortlepel 2020-11-17 23:21:21 +01:00
parent a78f65b274
commit e2a45601b3
3 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ std::string GenerateCall() {
return Ret.str();
}
std::string RunPromise(const std::string& IP, const std::string& R) {
std::packaged_task<std::string()> task([&]() { return PostHTTP(IP, R); });
std::packaged_task<std::string()> task([&] { return PostHTTP(IP, R); });
std::future<std::string> f1 = task.get_future();
std::thread t(std::move(task));
t.detach();

View File

@ -43,6 +43,7 @@ std::string PostHTTP(const std::string& IP, const std::string& Fields) {
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (res != CURLE_OK)

View File

@ -10,7 +10,6 @@
#include <mutex>
#include <sstream>
#include <thread>
#include <unistd.h>
#include <unordered_map>
static RWMutex ThreadNameMapMutex;
@ -95,7 +94,7 @@ void DebugPrintTIDInternal(const std::string& func, bool overwrite) {
#ifdef DEBUG
std::scoped_lock Guard(LogLock);
std::stringstream Print;
Print << "(debug build) Thread '" << std::this_thread::get_id() << "' / '" << gettid() << "' is " << func << "\n";
Print << "(debug build) Thread '" << std::this_thread::get_id() << "' is " << func << "\n";
ConsoleOut(Print.str());
#endif // DEBUG
}