SI-7221 rewrites pollForWork non-recursively

Fixes #1001407
Merge pull request #3154 from huitseeker/issue/SI-7221-PR

SI-7221 Rewrites pollForWork non-recursively