Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix sporadic ansible-runner macOS bug and remove extra listener thread
It was found that on macOS a sporadic failure would occur where the internal listener, while started, wouldn't actually start listening right away, causing the listener to miss the file we were waiting for. The listen gem creates an internal thread, `@run_thread`, which on most target systems is where the actually listening is done. However, on macOS, `@run_thread` creates a second thread, `@worker_thread`, which does the actual listening. It's possible that although the listener is started, the @worker_thread hasn't actually started yet. This leaves a window where the target_path we are waiting on can actually be created before the `@worker_thread` is started and we "miss" the creation of the target_path. This commit ensures that we won't move on until that thread is ready, further ensuring we can't miss the creation of the target_path. Ansible::Runner#wait_for was also creating an extra thread when starting the listener, but this thread is unnecessary as the listen gem creates its own internal thread under the covers.
- Loading branch information