|
40 | 40 | #include <thread> |
41 | 41 |
|
42 | 42 | class THttpTimer : public TTimer { |
43 | | - Long_t fNormalTmout{0}; |
44 | | - Bool_t fSlow{kFALSE}; |
45 | | - Int_t fSlowCnt{0}; |
46 | 43 |
|
47 | 44 | public: |
48 | 45 | THttpServer &fServer; ///!< server processing requests |
49 | 46 |
|
50 | 47 | /// 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) {} |
52 | 49 |
|
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; } |
70 | 50 |
|
71 | 51 | /// timeout handler |
72 | 52 | /// used to process http requests in main ROOT thread |
73 | 53 | void Timeout() override |
74 | 54 | { |
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(); |
84 | 56 | } |
85 | 57 | }; |
86 | 58 |
|
@@ -656,9 +628,6 @@ Bool_t THttpServer::ExecuteHttp(std::shared_ptr<THttpCallArg> arg) |
656 | 628 | return kTRUE; |
657 | 629 | } |
658 | 630 |
|
659 | | - if (fTimer && fTimer->IsSlow()) |
660 | | - fTimer->SetSlow(kFALSE); |
661 | | - |
662 | 631 | // add call arg to the list |
663 | 632 | std::unique_lock<std::mutex> lk(fMutex); |
664 | 633 | arg->fNotifyFlag = kFALSE; |
@@ -1317,9 +1286,6 @@ Bool_t THttpServer::ExecuteWS(std::shared_ptr<THttpCallArg> &arg, Bool_t externa |
1317 | 1286 |
|
1318 | 1287 | if (external_thrd && (!handler || !handler->AllowMTProcess())) { |
1319 | 1288 |
|
1320 | | - if (fTimer && fTimer->IsSlow()) |
1321 | | - fTimer->SetSlow(kFALSE); |
1322 | | - |
1323 | 1289 | std::unique_lock<std::mutex> lk(fMutex); |
1324 | 1290 | fArgs.push(arg); |
1325 | 1291 | // and now wait until request is processed |
|
0 commit comments