Retry/fail logic for source and PDF capture.

Try each capture task up to 3 times, with 30 second pauses after failures. If we fail 3 tries for any reason, update the status from 'pending' to 'failed'.

This fixes part of #599