CG-2786: Reordered time limit and run count checks to ensure they are always run regardless of the success of the last job
CG-2786: Added tick function to flush the buffer to the log