]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
common/Throttle: update BackoffThrottle::get() to work with unsigned delay 25105/head
authorKefu Chai <kchai@redhat.com>
Wed, 21 Nov 2018 16:38:37 +0000 (00:38 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 22 Nov 2018 03:26:43 +0000 (11:26 +0800)
commit63ced34d3ee4bb413cf85401f767385daca55a20
tree61b0f36fe884cc19de1c8bf59724bde7a4240bdf
parent03029f431b2f8cfbe7f87ec8ec599db1deb2cb21
common/Throttle: update BackoffThrottle::get() to work with unsigned delay

* in fa3acba3, we switched the delay's type from
  std::chrono::duration<double> to ceph::timespan, the former's Rep is a
  signed type, while the latter is unsigned. so we need to update the
  algorithm in get() to accomodate this change.
* use mono_clock instead of real_clock for better performance
* check for 0 timespan using count() == 0, instead of comparing it with
  a temporary object created using ceph::timespan(0) for better
  performance

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/Throttle.cc