diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-02-08 13:40:53 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-02-08 13:40:53 +0000 |
commit | 1adab1c56687f956381b6558dae0c127204427eb (patch) | |
tree | 134be44c3fb11e2ec16110ab490929d26a754c32 /searchcore | |
parent | f18b80d57b544e33c7decc6f04ad2659c2c1196d (diff) |
Avoid underflow
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/matcher.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp index cf7cbe9b8d9..d68c5a667ac 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp @@ -317,7 +317,11 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl if (my_stats.softDoomed()) { double old = _stats.softDoomFactor(); fastos::TimeStamp softLimit = uint64_t((1.0 - _rankSetup->getSoftTimeoutTailCost()) * request.getTimeout()); - _stats.updatesoftDoomFactor(request.getTimeout(), softLimit, duration - my_stats.doomOvertime()); + fastos::TimeStamp adjustedDuration = duration - my_stats.doomOvertime(); + if (adjustedDuration < 0) { + adjustedDuration = 0; + } + _stats.updatesoftDoomFactor(request.getTimeout(), softLimit, adjustedDuration); LOG(info, "Triggered softtimeout factor adjustment. request=%1.3f, doomOvertime=%1.3f, limit=%1.3f and duration=%1.3f, rankprofile=%s" ", factor adjusted from %1.3f to %1.3f", request.getTimeout().sec(), my_stats.doomOvertime().sec(), softLimit.sec(), duration.sec(), |