🔥 removed thread_local for cached responses

This commit is contained in:
EntireTwix 2021-07-28 17:41:44 -07:00
parent 24053efeb8
commit 9a67d223dc

View file

@ -14,10 +14,10 @@ static thread_local ondemand::parser parser;
CORS; \ CORS; \
callback(resp) callback(resp)
#define RESPOND_TRUE \ #define RESPOND_TRUE \
static thread_local auto resp = HttpResponse::newCustomHttpResponse(BankResponse{k204NoContent, std::nullopt}); \ auto resp = HttpResponse::newCustomHttpResponse(BankResponse{k204NoContent, std::nullopt}); \
CORS; \ CORS; \
CACHE_FOREVER; \ CACHE_FOREVER; \
callback(resp) callback(resp)
#define NAME_PARAM req->getParameter("name") #define NAME_PARAM req->getParameter("name")
@ -34,7 +34,7 @@ void api::GetLogs(req_args)
#if MAX_LOG_SIZE > 0 #if MAX_LOG_SIZE > 0
RESPONSE_PARSE(Bank::GetLogs(NAME_PARAM)); RESPONSE_PARSE(Bank::GetLogs(NAME_PARAM));
#else #else
static thread_local auto resp = HttpResponse::newCustomHttpResponse(BankResponse{k404NotFound, "\"Logs are Disabled\""}); auto resp = HttpResponse::newCustomHttpResponse(BankResponse{k404NotFound, "\"Logs are Disabled\""});
CORS; CORS;
CACHE_FOREVER; CACHE_FOREVER;
callback(resp); callback(resp);
@ -176,7 +176,7 @@ void api::ImpactBal(req_args)
//System Usage //System Usage
void api::Help(req_args) void api::Help(req_args)
{ {
static thread_local auto resp = HttpResponse::newRedirectionResponse("https://github.com/EntireTwix/CCash/blob/README.md", k301MovedPermanently); auto resp = HttpResponse::newRedirectionResponse("https://github.com/EntireTwix/CCash/blob/README.md", k301MovedPermanently);
CACHE_FOREVER; CACHE_FOREVER;
callback(resp); callback(resp);
} }
@ -214,7 +214,7 @@ void api::ApiProperties(req_args)
{ {
info += "}"; info += "}";
} }
static thread_local auto resp = HttpResponse::newCustomHttpResponse(BankResponse{k200OK, std::move(info)}); auto resp = HttpResponse::newCustomHttpResponse(BankResponse{k200OK, std::move(info)});
CORS; CORS;
CACHE_FOREVER; CACHE_FOREVER;
callback(resp); callback(resp);