fix pid status and add sleep for delayed_job