Commits

Anonymous committed c8e42c2

guard against too short interval and raise exception in that case

Comments (0)

Files changed (2)

turtl/__init__.py

-__version__ = '0.0.4'
+__version__ = '0.0.5'
 from twisted.internet import defer, task
 
+class IntervalTooShortError(Exception):
+    pass
+
 class _ConcurrencyPrimitive(object):
     _execute = defer.maybeDeferred
 
         """
         _ConcurrencyPrimitive.__init__(self)
 
+        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._sem.run