diff --git a/src/OutputByOrbit.cc b/src/OutputByOrbit.cc index 2e0e59f6a425a05bd56c746f2d2ad244acbc83ed..083f59f5771921fb23e0138fa246f07426695714 100644 --- a/src/OutputByOrbit.cc +++ b/src/OutputByOrbit.cc @@ -33,11 +33,18 @@ void OutputByOrbitStream::OutputFixedOrbits(Slice &out) { control.output_force_write) { // i.e should be writing data n = fwrite(out.begin(), 1, out.size(), output_file_handler_.getFile(control.run_number, index)); + current_file_size += n; + } else if (output_file_handler_.hasFile()) { + // the run has been stopped so drop but first check if there is a last + // file to close + LOG(TRACE) << "the run was stopped. queueing the last file for close and " + "rename "; + output_file_handler_.enqueue_current_file_for_close_and_move_maybe(); } - current_file_size += n; + } else { // i.e should not currently be writing data - but then we should // never get here in the first place - output_file_handler_.enqueue_current_file_for_close_and_move_maybe(); + LOG(TRACE) << "got an empty slice "; } }