From b105304a1b504827a86a93f3e8ad33abbbc5b1fc Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 13 Oct 2008 23:27:49 +0000 Subject: [PATCH 1/1] Fix race condition adding traces. Closes #1201. --- app/controllers/trace_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 899df05df..f0e1fe7cc 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -306,10 +306,9 @@ private @trace.user = @user @trace.timestamp = Time.now - if @trace.save - FileUtils.mv(filename, @trace.trace_name) - else - FileUtils.rm_f(filename) + FileUtils.mv(filename, @trace.trace_name) + unless @trace.save + FileUtils.rm_f(@trace.trace_name) end end -- 2.43.2