core: sleep between state checks for communicator [GH-2163]

This commit is contained in:
Mitchell Hashimoto 2013-09-15 17:33:05 -07:00
parent 5e468dd110
commit e515ca22ab
3 changed files with 8 additions and 1 deletions

View File

@ -13,6 +13,7 @@ BUG FIXES:
- core: `Guest#capability?` now works with strings as well
- core: Fix NoMethodError in the new `Vagrant.has_plugin?` method [GH-2189]
- core: Convert forwarded port parameters to integers. [GH-2173]
- core: Don't spike CPU to 100% while waiting for machine to boot. [GH-2163]
- hosts/arch: NFS exporting works properly, no exceptions. [GH-2161]
- hosts/bsd: Use only `sudo` for writing NFS exports. This lets NFS
exports work if you have sudo privs but not `su`. [GH-2191]

View File

@ -34,12 +34,18 @@ module Vagrant
# Otherwise, periodically verify the VM isn't in a bad state.
while true
state = env[:machine].provider.state.id
# Used to report invalid states
Thread.current[:last_known_state] = state
# Check if we have the proper state so we can break out
if !@states.include?(state)
Thread.current[:result] = false
break
end
# Sleep a bit so we don't hit 100% CPU constantly.
sleep 1
end
end

View File

@ -55,7 +55,7 @@ module Vagrant
Timeout.timeout(duration) do
while true
return true if ready?
sleep 0.2
sleep 0.5
end
end
rescue Timeout::Error