diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-01-31 15:14:57 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-01-31 17:36:43 +0000 |
commit | 2503a877f21838e66e873f839a5b6fd0c38abfab (patch) | |
tree | 966ae9d7757aa58e7bff4aaa4b9b45b5f6668329 /searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp | |
parent | 5ac0d0b71749c7555167c3c3906ff6843bf178f0 (diff) |
Use vespalib::duration for timeouts
Diffstat (limited to 'searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp')
-rw-r--r-- | searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index 1127191a1a2..8840d4778e0 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -78,20 +78,20 @@ struct Rendezvous { vespalib::Gate gone; typedef std::unique_ptr<Rendezvous> UP; Rendezvous() : enter(), leave(), gone() {} - bool run(uint32_t timeout = 80000) { + bool run(vespalib::duration timeout = 80s) { enter.countDown(); bool retval = leave.await(timeout); gone.countDown(); return retval; } - bool waitForEnter(uint32_t timeout = 80000) { + bool waitForEnter(vespalib::duration timeout = 80s) { return enter.await(timeout); } - bool leaveAndWait(uint32_t timeout = 80000) { + bool leaveAndWait(vespalib::duration timeout = 80s) { leave.countDown(); return gone.await(timeout); } - bool await(uint32_t timeout = 80000) { + bool await(vespalib::duration timeout = 80s) { if (waitForEnter(timeout)) { return leaveAndWait(timeout); } @@ -373,7 +373,7 @@ struct FeedTokenContext { FeedTokenContext(); ~FeedTokenContext(); - bool await(uint32_t timeout = 80000) { return transport.gate.await(timeout); } + bool await(vespalib::duration timeout = 80s) { return transport.gate.await(timeout); } const Result *getResult() { if (transport.result.get()) { return transport.result.get(); @@ -399,36 +399,6 @@ struct PutContext { {} }; - -struct PutHandler { - FeedHandler &handler; - DocBuilder &builder; - Timestamp timestamp; - std::vector<PutContext::SP> puts; - PutHandler(FeedHandler &fh, DocBuilder &db) : - handler(fh), - builder(db), - timestamp(0), - puts() - {} - void put(const vespalib::string &docId) { - PutContext::SP pc(new PutContext(docId, builder)); - FeedOperation::UP op(new PutOperation(pc->docCtx.bucketId, timestamp, pc->docCtx.doc)); - handler.handleOperation(pc->tokenCtx.token, std::move(op)); - timestamp = Timestamp(timestamp + 1); - puts.push_back(pc); - } - bool await(uint32_t timeout = 80000) { - for (const auto & put : puts) { - if (!put->tokenCtx.await(timeout)) { - return false; - } - } - return true; - } -}; - - struct MyTlsWriter : TlsWriter { int store_count; int erase_count; |