From 7647ff3dead5129b039c025745b1c43f8f3dc76b Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Thu, 1 Apr 2021 11:04:04 -0400 Subject: [PATCH] Report work queue depth in errors and increase default rpcthreads to 8 --- src/httpserver.cpp | 12 +++++------- src/httpserver.h | 3 ++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 45455825a..0e4e42c2b 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -1,9 +1,9 @@ // Copyright (c) 2015 The Bitcoin Core developers +// Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html #include "httpserver.h" - #include "chainparamsbase.h" #include "compat.h" #include "util.h" @@ -12,15 +12,12 @@ #include "sync.h" #include "ui_interface.h" #include "utilstrencodings.h" - #include #include #include - #include #include #include - #include #include #include @@ -292,10 +289,11 @@ static void http_request_cb(struct evhttp_request* req, void* arg) if (i != iend) { std::unique_ptr item(new HTTPWorkItem(hreq.release(), path, i->handler)); assert(workQueue); - if (workQueue->Enqueue(item.get())) + if (workQueue->Enqueue(item.get())) { item.release(); /* if true, queue took ownership */ - else - item->req->WriteReply(HTTP_INTERNAL, "Work queue depth exceeded"); + } else { + item->req->WriteReply(HTTP_INTERNAL, strprintf("Work queue depth %d exceeded", workQueue->Depth() )); + } } else { hreq->WriteReply(HTTP_NOTFOUND); } diff --git a/src/httpserver.h b/src/httpserver.h index 41456ba6d..b903f91cd 100644 --- a/src/httpserver.h +++ b/src/httpserver.h @@ -1,4 +1,5 @@ // Copyright (c) 2015 The Bitcoin Core developers +// Copyright (c) 2016-2021 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html @@ -14,7 +15,7 @@ #include #include -static const int DEFAULT_HTTP_THREADS=4; +static const int DEFAULT_HTTP_THREADS=8; static const int DEFAULT_HTTP_WORKQUEUE=16; static const int DEFAULT_HTTP_SERVER_TIMEOUT=30;