From c80d4aaea9466e0388b3a57e190292347e1fca18 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Thu, 5 May 2022 12:59:45 -0400 Subject: [PATCH] 18794: Fix reload_config: don't assume restart.txt already exists. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- services/api/config/initializers/reload_config.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/api/config/initializers/reload_config.rb b/services/api/config/initializers/reload_config.rb index 0698f92ca0..65f02e07a4 100644 --- a/services/api/config/initializers/reload_config.rb +++ b/services/api/config/initializers/reload_config.rb @@ -47,7 +47,11 @@ else restartfile = Rails.root.join('tmp', 'restart.txt') touchtime = Time.now Rails.logger.info("reload_config: mtime on #{conffile} changed to #{t}, touching #{restartfile} to #{touchtime}") - File.utime(touchtime, touchtime, restartfile) + begin + File.utime(touchtime, touchtime, restartfile) + rescue + File.open(restartfile, 'w') {} + end # Even if passenger doesn't notice that we hit restart.txt # and kill our process, there's no point waiting around to # hit it again. -- 2.30.2