Limit scheduler sleeping when master backend shutdown is enabled.

The longer sleeps added in a2eb9312 could prevent the pending shutdown
events from being sent.

(cherry picked from commit 7fcc9ccc031eb6418b193b71970ca627c95e1d5c)