Anonymous committed 5b9846a

bump to 0.0.6 and fix the annoying lock up with high frequency

Comments (0)

Files changed (2)


-__version__ = '0.0.5'
+__version__ = '0.0.6'
 from twisted.internet import defer, task
-class IntervalTooShortError(Exception):
-    pass
 class _ConcurrencyPrimitive(object):
     _execute = defer.maybeDeferred
-        if interval < .1:
-            raise IntervalTooShortError("Can't set interval less than .1. Raise the number of calls")
         self._sem = defer.DeferredSemaphore(concurrency)
         self._execute =
         self._resetLoop = task.LoopingCall(self._reset)
         self._resetLoop.start(interval, now=False)
+        self._lastReset = None
     def _reset(self):
         # We don't want to release while calls are in timeout mode
         # so we schedule the release to run right after a request
         # has completed.
         self.points = self.calls
+        # If we don't check for this we will overflow the queue on long running calls.
+        if self._lastReset and self._lastReset.called:
+            self._lastReset =
     def acquire(self, priority=False):
         """Attempt to acquire the token.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.