Skip to content

Commit 6452bbb

Browse files
committed
[http] remove slow mode for timer
Was designed to reduce load on the CPU, but confuse users expecting faster response on http requests
1 parent e7fcd38 commit 6452bbb

File tree

1 file changed

+2
-36
lines changed

1 file changed

+2
-36
lines changed

net/http/src/THttpServer.cxx

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,47 +40,19 @@
4040
#include <thread>
4141

4242
class THttpTimer : public TTimer {
43-
Long_t fNormalTmout{0};
44-
Bool_t fSlow{kFALSE};
45-
Int_t fSlowCnt{0};
4643

4744
public:
4845
THttpServer &fServer; ///!< server processing requests
4946

5047
/// constructor
51-
THttpTimer(Long_t milliSec, Bool_t mode, THttpServer &serv) : TTimer(milliSec, mode), fNormalTmout(milliSec), fServer(serv) {}
48+
THttpTimer(Long_t milliSec, Bool_t mode, THttpServer &serv) : TTimer(milliSec, mode), fServer(serv) {}
5249

53-
void SetSlow(Bool_t flag)
54-
{
55-
fSlow = flag;
56-
fSlowCnt = 0;
57-
Long_t ms = fNormalTmout;
58-
if (fSlow) {
59-
if (ms < 100)
60-
ms = 500;
61-
else if (ms < 500)
62-
ms = 3000;
63-
else
64-
ms = 10000;
65-
}
66-
67-
SetTime(ms);
68-
}
69-
Bool_t IsSlow() const { return fSlow; }
7050

7151
/// timeout handler
7252
/// used to process http requests in main ROOT thread
7353
void Timeout() override
7454
{
75-
Int_t nprocess = fServer.ProcessRequests();
76-
77-
if (nprocess > 0) {
78-
fSlowCnt = 0;
79-
if (IsSlow())
80-
SetSlow(kFALSE);
81-
} else if (!IsSlow() && (fSlowCnt++ > 10)) {
82-
SetSlow(kTRUE);
83-
}
55+
fServer.ProcessRequests();
8456
}
8557
};
8658

@@ -656,9 +628,6 @@ Bool_t THttpServer::ExecuteHttp(std::shared_ptr<THttpCallArg> arg)
656628
return kTRUE;
657629
}
658630

659-
if (fTimer && fTimer->IsSlow())
660-
fTimer->SetSlow(kFALSE);
661-
662631
// add call arg to the list
663632
std::unique_lock<std::mutex> lk(fMutex);
664633
arg->fNotifyFlag = kFALSE;
@@ -1317,9 +1286,6 @@ Bool_t THttpServer::ExecuteWS(std::shared_ptr<THttpCallArg> &arg, Bool_t externa
13171286

13181287
if (external_thrd && (!handler || !handler->AllowMTProcess())) {
13191288

1320-
if (fTimer && fTimer->IsSlow())
1321-
fTimer->SetSlow(kFALSE);
1322-
13231289
std::unique_lock<std::mutex> lk(fMutex);
13241290
fArgs.push(arg);
13251291
// and now wait until request is processed

0 commit comments

Comments
 (0)