fixing race condition on failed flow and job metric