Skip to content

Commit

Permalink
squash w/ startup/shutdown. Avoid infinite loop on config reload.
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Nov 4, 2024
1 parent 1b057cd commit d71f6fc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/irods/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ def reload_configuration(self):
l.debug('Sending SIGHUP to iRODS server')
os.kill(server_pid, signal.SIGHUP)

# Helps protect against infinite loops.
loop_counter = 0

# Wait for a new agent factory to appear before starting the wait loop.
# This guarantees the python script connects to the new agent factory. Remember,
# the iRODS server doesn't launch the new agent factory until the old agent factory
Expand All @@ -151,8 +154,11 @@ def reload_configuration(self):
new_agent_factory_pid = self.find_agent_factory_pid()
if (new_agent_factory_pid is None) or (new_agent_factory_pid == old_agent_factory_pid):
time.sleep(1)
loop_counter += 1
if loop_counter == 15:
raise IrodsError('Reload may have failed. Please check log file and configuration.')
continue
l.debug('New agent factory has appeared [%s].', new_agent_factory_pid)
l.debug('New agent factory has appeared [pid=%s].', new_agent_factory_pid)
break

self.wait_for_server_to_start()
Expand Down

0 comments on commit d71f6fc

Please sign in to comment.