blob: eabd17ae73fbe3a7601b63e1e6e65cea7d6822b5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "worker.h"
#include <vbench/http/http_client.h>
namespace vbench {
VESPA_THREAD_STACK_TAG(vbench_worker_thread);
void
Worker::run()
{
for (;;) {
Request::UP request = _provider.provide();
if (request.get() == 0) {
break;
}
request->startTime(_timer.sample());
HttpClient::fetch(_pool, request->server(), request->url(), *request);
request->endTime(_timer.sample());
_next.handle(std::move(request));
}
}
Worker::Worker(Provider<Request> &provider, Handler<Request> &next,
HttpConnectionPool &pool, Timer &timer)
: _thread(),
_provider(provider),
_next(next),
_pool(pool),
_timer(timer)
{
_thread = vespalib::Thread::start(*this, vbench_worker_thread);
}
} // namespace vbench
|