move retry logic to task from worker