20137: Fix incorrect keyword in RailsAPI config reload loop
authorBrett Smith <brett.smith@curii.com>
Mon, 20 Feb 2023 19:46:41 +0000 (14:46 -0500)
committerBrett Smith <brett.smith@curii.com>
Mon, 20 Feb 2023 19:46:41 +0000 (14:46 -0500)
The reason rails_restart_test.go has been racey is because the code
under test is actually buggy. If the configuration reload loop ever
encounters a condition where it wants to restart (probably
`hash == hash_lastload`), it tries to call a nonexistent method
`continue`, the thread crashes, the configuration never gets reloaded,
and the test fails.

Use the intended Ruby keyword `next` instead.
Closes #20137.

Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith@curii.com>

services/api/config/initializers/reload_config.rb

index 1582855bfb29203a511546a3b7ec505dfee4658f..bdc815099d4f484c56e7964bb718525a3e66c465 100644 (file)
@@ -35,13 +35,13 @@ else
           rescue => e
             Rails.logger.info("reload_config: config file updated but could not be loaded: #{e}")
             t_lastload = t
-            continue
+            next
           end
           if hash == hash_lastload
             # If we reloaded a new or updated file, but the content is
             # identical, keep polling instead of restarting.
             t_lastload = t
-            continue
+            next
           end
 
           restartfile = Rails.root.join('tmp', 'restart.txt')