fix job db logging, put record only if job need to run.