mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-23 00:17:00 +00:00
possibly fix recurring backend timeout
This commit is contained in:
@@ -34,7 +34,7 @@ std::string GenerateCall() {
|
|||||||
return Ret.str();
|
return Ret.str();
|
||||||
}
|
}
|
||||||
std::string RunPromise(const std::string& IP, const std::string& R) {
|
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::future<std::string> f1 = task.get_future();
|
||||||
std::thread t(std::move(task));
|
std::thread t(std::move(task));
|
||||||
t.detach();
|
t.detach();
|
||||||
|
|||||||
@@ -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_WRITEFUNCTION, WriteCallback);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
|
||||||
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5);
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
if (res != CURLE_OK)
|
if (res != CURLE_OK)
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <unistd.h>
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
static RWMutex ThreadNameMapMutex;
|
static RWMutex ThreadNameMapMutex;
|
||||||
@@ -95,7 +94,7 @@ void DebugPrintTIDInternal(const std::string& func, bool overwrite) {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::scoped_lock Guard(LogLock);
|
std::scoped_lock Guard(LogLock);
|
||||||
std::stringstream Print;
|
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());
|
ConsoleOut(Print.str());
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user