diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-12-15 13:05:59 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-12-15 13:05:59 +0000 |
commit | 5e8cbd4cb425a606555f50a14affd37685938c44 (patch) | |
tree | 48cc0efbfb8350ef7e91cc58dc824c3088a0bc38 | |
parent | 1e1ebc215480ab75e09f3cd7a016bbdf0831c423 (diff) |
Better naming and simpler code.
7 files changed, 14 insertions, 14 deletions
diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp index d476f7d35d7..2237096a06c 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp @@ -1113,7 +1113,7 @@ SearchContextTest::performRangeSearch(const VectorType & vec, const vespalib::st { for (size_t num_threads : {1,3}) { vespalib::SimpleThreadBundle thread_bundle(num_threads); - auto executeInfo = queryeval::ExecuteInfo::create(true, 1.0, vespalib::Doom::armageddon(), thread_bundle, true, true); + auto executeInfo = queryeval::ExecuteInfo::create(true, 1.0, vespalib::Doom::never(), thread_bundle, true, true); performSearch(executeInfo, vec, term, expected, TermType::WORD); } } diff --git a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp index 0d3dccd2f1c..b1b2235165f 100644 --- a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp +++ b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp @@ -1325,7 +1325,7 @@ public: std::make_unique<DistanceCalculator>(this->as_dense_tensor(), create_query_tensor(vec_2d(17, 42))), 3, approximate, 5, 100100.25, - global_filter_lower_limit, 1.0, target_hits_max_adjustment_factor, vespalib::Doom::armageddon()); + global_filter_lower_limit, 1.0, target_hits_max_adjustment_factor, vespalib::Doom::never()); EXPECT_EQUAL(11u, bp->getState().estimate().estHits); EXPECT_EQUAL(100100.25 * 100100.25, bp->get_distance_threshold()); return bp; diff --git a/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp b/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp index 5ae65586829..d8e38bc4ccc 100644 --- a/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/executeinfo.cpp @@ -5,16 +5,16 @@ using vespalib::Doom; namespace search::queryeval { -const ExecuteInfo ExecuteInfo::TRUE(true, 1.0, Doom::armageddon(), vespalib::ThreadBundle::trivial(), true, true); -const ExecuteInfo ExecuteInfo::FALSE(false, 1.0, Doom::armageddon(), vespalib::ThreadBundle::trivial(), true, true); +const ExecuteInfo ExecuteInfo::TRUE(true, 1.0, Doom::never(), vespalib::ThreadBundle::trivial(), true, true); +const ExecuteInfo ExecuteInfo::FALSE(false, 1.0, Doom::never(), vespalib::ThreadBundle::trivial(), true, true); ExecuteInfo::ExecuteInfo() noexcept - : ExecuteInfo(false, 1.0, Doom::armageddon(), vespalib::ThreadBundle::trivial(), true, true) + : ExecuteInfo(false, 1.0, Doom::never(), vespalib::ThreadBundle::trivial(), true, true) { } ExecuteInfo ExecuteInfo::createForTest(bool strict, double hitRate) noexcept { - return createForTest(strict, hitRate, Doom::armageddon()); + return createForTest(strict, hitRate, Doom::never()); } } diff --git a/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/HttpRequestStrategyTest.java b/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/HttpRequestStrategyTest.java index 18fa7d94117..36e81ff4abb 100644 --- a/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/HttpRequestStrategyTest.java +++ b/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/HttpRequestStrategyTest.java @@ -220,7 +220,7 @@ class HttpRequestStrategyTest { if (req == blocking) { phaser.arriveAndAwaitAdvance(); // Synchronise with test main thread, and then ... blocker.arriveAndAwaitAdvance(); // ... block dispatch thread, so we get something in the queue. - throw new RuntimeException("armageddon"); // Dispatch thread should die, tearing down everything. + throw new RuntimeException("never"); // Dispatch thread should die, tearing down everything. } else if (req == partial) { phaser.arriveAndAwaitAdvance(); // Let test thread enqueue more ops before failing (and retrying) this. diff --git a/vespalib/src/vespa/vespalib/util/clock.h b/vespalib/src/vespa/vespalib/util/clock.h index 967bd07cbd4..1e37e3fff8d 100644 --- a/vespalib/src/vespa/vespalib/util/clock.h +++ b/vespalib/src/vespa/vespalib/util/clock.h @@ -8,7 +8,7 @@ namespace vespalib { /** - * Clock is a clock that updates the time at defined intervals. + * TODO Remove abstraction. Can use atomic ref directly * It is intended used where you want to check the time with low cost, but where * resolution is not that important. */ diff --git a/vespalib/src/vespa/vespalib/util/doom.cpp b/vespalib/src/vespa/vespalib/util/doom.cpp index fa036c0c9c7..8fc82031e79 100644 --- a/vespalib/src/vespa/vespalib/util/doom.cpp +++ b/vespalib/src/vespa/vespalib/util/doom.cpp @@ -5,10 +5,6 @@ namespace vespalib { -namespace { - vespalib::FakeDoom practicallyNeverExpire(std::chrono::hours(24*365*100)); // doom in 100 years -} - Doom::Doom(const Clock &clock, steady_time softDoom, steady_time hardDoom, bool explicitSoftDoom) noexcept : _clock(clock), @@ -17,6 +13,10 @@ Doom::Doom(const Clock &clock, steady_time softDoom, _isExplicitSoftDoom(explicitSoftDoom) { } -const Doom & Doom::armageddon() noexcept { return practicallyNeverExpire.get_doom(); } +const Doom & +Doom::never() noexcept { + static vespalib::FakeDoom neverExpire; + return neverExpire.get_doom(); +} } diff --git a/vespalib/src/vespa/vespalib/util/doom.h b/vespalib/src/vespa/vespalib/util/doom.h index bf9d9343b8c..1d7070cedd0 100644 --- a/vespalib/src/vespa/vespalib/util/doom.h +++ b/vespalib/src/vespa/vespalib/util/doom.h @@ -19,7 +19,7 @@ public: duration soft_left() const noexcept { return _softDoom - _clock.getTimeNS(); } duration hard_left() const noexcept { return _hardDoom - _clock.getTimeNS(); } bool isExplicitSoftDoom() const noexcept { return _isExplicitSoftDoom; } - static const Doom & armageddon() noexcept; + static const Doom & never() noexcept; private: const Clock &_clock; steady_time _softDoom; |