python: Properly abort when over request limit.
[ashd.git] / python3 / ashd / serve.py
index 9f9fe7f..fe839a2 100644 (file)
@@ -1,4 +1,4 @@
-import threading, time, logging
+import os, threading, time, logging
 
 log = logging.getLogger("ashd.serve")
 seq = 1
@@ -113,3 +113,8 @@ class calllimiter(object):
     def call(self, target):
         with self:
             return target()
+
+class abortlimiter(calllimiter):
+    def waited(self, time):
+        if time > 10:
+            os.abort()