Report work queue depth in errors and increase default rpcthreads to 8
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
// Copyright (c) 2015 The Bitcoin Core developers
|
// Copyright (c) 2015 The Bitcoin Core developers
|
||||||
|
// Copyright (c) 2016-2021 The Hush developers
|
||||||
// Distributed under the GPLv3 software license, see the accompanying
|
// Distributed under the GPLv3 software license, see the accompanying
|
||||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||||
|
|
||||||
#include "httpserver.h"
|
#include "httpserver.h"
|
||||||
|
|
||||||
#include "chainparamsbase.h"
|
#include "chainparamsbase.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@@ -12,15 +12,12 @@
|
|||||||
#include "sync.h"
|
#include "sync.h"
|
||||||
#include "ui_interface.h"
|
#include "ui_interface.h"
|
||||||
#include "utilstrencodings.h"
|
#include "utilstrencodings.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include <event2/event.h>
|
#include <event2/event.h>
|
||||||
#include <event2/http.h>
|
#include <event2/http.h>
|
||||||
#include <event2/thread.h>
|
#include <event2/thread.h>
|
||||||
@@ -292,10 +289,11 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
|
|||||||
if (i != iend) {
|
if (i != iend) {
|
||||||
std::unique_ptr<HTTPWorkItem> item(new HTTPWorkItem(hreq.release(), path, i->handler));
|
std::unique_ptr<HTTPWorkItem> item(new HTTPWorkItem(hreq.release(), path, i->handler));
|
||||||
assert(workQueue);
|
assert(workQueue);
|
||||||
if (workQueue->Enqueue(item.get()))
|
if (workQueue->Enqueue(item.get())) {
|
||||||
item.release(); /* if true, queue took ownership */
|
item.release(); /* if true, queue took ownership */
|
||||||
else
|
} else {
|
||||||
item->req->WriteReply(HTTP_INTERNAL, "Work queue depth exceeded");
|
item->req->WriteReply(HTTP_INTERNAL, strprintf("Work queue depth %d exceeded", workQueue->Depth() ));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hreq->WriteReply(HTTP_NOTFOUND);
|
hreq->WriteReply(HTTP_NOTFOUND);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Copyright (c) 2015 The Bitcoin Core developers
|
// Copyright (c) 2015 The Bitcoin Core developers
|
||||||
|
// Copyright (c) 2016-2021 The Hush developers
|
||||||
// Distributed under the GPLv3 software license, see the accompanying
|
// Distributed under the GPLv3 software license, see the accompanying
|
||||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@
|
|||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
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_WORKQUEUE=16;
|
||||||
static const int DEFAULT_HTTP_SERVER_TIMEOUT=30;
|
static const int DEFAULT_HTTP_SERVER_TIMEOUT=30;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user