|  | @@ -59,10 +59,11 @@ For this reason your tasks run-time shouldn't exceed the timeout.
 | 
	
		
			
				|  |  |          finally:
 | 
	
		
			
				|  |  |              # memcache delete is very slow, but we have to use it to take
 | 
	
		
			
				|  |  |              # advantage of using add() for atomic locking
 | 
	
		
			
				|  |  | -            if monotonic() < timeout_at:
 | 
	
		
			
				|  |  | +            if monotonic() < timeout_at and status:
 | 
	
		
			
				|  |  |                  # don't release the lock if we exceeded the timeout
 | 
	
		
			
				|  |  |                  # to lessen the chance of releasing an expired lock
 | 
	
		
			
				|  |  | -                # owned by someone else.
 | 
	
		
			
				|  |  | +                # owned by someone else
 | 
	
		
			
				|  |  | +                # also don't release the lock if we didn't acquire it
 | 
	
		
			
				|  |  |                  cache.delete(lock_id)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @task(bind=True)
 |