Use a dynamic timeout to wait for the optimal time.
Merge pull request #687 from benoitc/feature/no_active_idle-2

Feature/no active idle 2