From 15980471b0b17407928bd303189d05a13eaf4966 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 22 Jun 2014 22:41:56 +0200 Subject: [PATCH] Create api lock on the fly --- couchpotato/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/couchpotato/api.py b/couchpotato/api.py index 17942583..99a2c6ad 100644 --- a/couchpotato/api.py +++ b/couchpotato/api.py @@ -91,6 +91,10 @@ class ApiHandler(RequestHandler): self.write('API call doesn\'t seem to exist') return + # Create lock if it doesn't exist + if route in api_locks and not api_locks.get(route): + api_locks[route] = threading.Lock() + api_locks[route].acquire() try: