~notmyname/swift/stats_mapper

« back to all changes in this revision

Viewing changes to swift/common/middleware/ratelimit.py

  • Committer: Tarmac
  • Author(s): David Goetz
  • Date: 2010-10-21 15:22:30 UTC
  • mfrom: (104.2.2 fix_ratelimit)
  • Revision ID: hudson@openstack.org-20101021152230-pur20ej7f7igezea
Bug fix: Memcached does not allow negative numbers passed to incr.  Adding/using decr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
        max_sleep_m = self.max_sleep_time_seconds * self.clock_accuracy
149
149
        if max_sleep_m - need_to_sleep_m <= self.clock_accuracy * 0.01:
150
150
            # treat as no-op decrement time
151
 
            self.memcache_client.incr(key, delta=-time_per_request_m)
 
151
            self.memcache_client.decr(key, delta=time_per_request_m)
152
152
            raise MaxSleepTimeHit("Max Sleep Time Exceeded: %s" %
153
153
                                  need_to_sleep_m)
154
154