mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Fix an issue where a well timed cancel could try to cancel a job right
after it has finished causing an error.
This commit is contained in:
parent
d46d9bb7f4
commit
472f086862
@ -393,11 +393,12 @@ class BaseTask(Task):
|
||||
# Refresh model instance from the database (to check cancel flag).
|
||||
instance = self.update_model(instance.pk)
|
||||
if instance.cancel_flag:
|
||||
try:
|
||||
os.kill(child.pid, signal.SIGINT)
|
||||
time.sleep(3)
|
||||
# The following line causes orphaned ansible processes
|
||||
# child.terminate(canceled)
|
||||
canceled = True
|
||||
except OSError:
|
||||
logger.warn("Attempted to cancel already finished job, ignoring")
|
||||
if idle_timeout and (time.time() - last_stdout_update) > idle_timeout:
|
||||
child.close(True)
|
||||
canceled = True
|
||||
|
Loading…
Reference in New Issue
Block a user