Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely on 10 minute starting_timeout instead of a heartbeating thread #14053

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions app/models/embedded_ansible_worker/runner.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
class EmbeddedAnsibleWorker::Runner < MiqWorker::Runner
def prepare
Thread.new do
setup_ansible
started_worker_record
end
self.wait_for_worker_monitor = false

def prepare
# Override prepare so we don't get set as started
self
end

# This thread runs forever until a stop request is received, which with send us to do_exit to exit our thread
def do_work_loop
Thread.new do
_log.info("waiting for ansible to start...")
loop do
# handle if the ansible setup blew up or timed out
break if worker.reload.started?
heartbeat
send(poll_method)
end
begin
setup_ansible
started_worker_record

update_embedded_ansible_provider
update_embedded_ansible_provider

_log.info("entering ansible monitor loop")
loop do
do_work
send(poll_method)
_log.info("entering ansible monitor loop")
loop do
do_work
send(poll_method)
end
rescue => err
_log.log_backtrace(err)
do_exit
end
end
end
Expand Down