Fixes a race condition which could result in a scheduled item being added to the queue twice, or a retry being retried twice.
Merge pull request #1495 from mperham/feature/race

Fixes a race condition which could result in a scheduled item being adde...