This completes the changes required for #221.

Adjusts for the fact that the old task.is_waiting() test used to return
True for retrying tasks as well as ones in the 'waiting' state. Now we
do direct tests on the state value, so must check for 'retrying' too
where appropriate.
Merge pull request #225 from hjoliver/221-follow-up

This completes the changes required for #221.