File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -283,25 +283,29 @@ def perform(self):
283283
284284 self .task .is_main_task = True
285285
286- try :
287- lock = None
286+ if not self .task .max_concurrency :
287+
288+ result = self .task .run_wrapped (self .data ["params" ])
288289
289- if self . task . max_concurrency :
290+ else :
290291
291- if self .task .max_concurrency > 1 :
292- raise NotImplementedError ()
292+ if self .task .max_concurrency > 1 :
293+ raise NotImplementedError ()
294+
295+ lock = None
296+ try :
293297
294298 # TODO: implement a semaphore
295299 lock = context .connections .redis .lock (self .redis_max_concurrency_key , timeout = self .timeout + 5 )
296300 if not lock .acquire (blocking = True , blocking_timeout = 0 ):
297301 raise MaxConcurrencyInterrupt ()
298302
299- result = self .task .run_wrapped (self .data ["params" ])
303+ result = self .task .run_wrapped (self .data ["params" ])
300304
301- finally :
302- if lock :
305+ finally :
303306 try :
304- lock .release ()
307+ if lock :
308+ lock .release ()
305309 except LockError :
306310 pass
307311
You can’t perform that action at this time.
0 commit comments