Module: Lich::Common::BestEffortShutdownCleanup
- Defined in:
- documented/common/best_effort_shutdown_cleanup.rb
Overview
Performs local cleanup after the frontend or game connection is disrupted.
Unlike OrderlyShutdown, this runner does not assume game request/response I/O is still usable. It preserves local state and runs bounded script teardown as best effort, then lets the existing post-join closeout handle sockets, databases, lifecycle unregister, and process exit.
Defined Under Namespace
Classes: Result
Class Method Summary collapse
-
.run(coordinator:, initial_scripts:, remaining_scripts:, script_drain:, vars:, active_sessions_lifecycle: nil, slow_threshold: 1.5) ⇒ Result
Executes best-effort local cleanup once.
Class Method Details
.run(coordinator:, initial_scripts:, remaining_scripts:, script_drain:, vars:, active_sessions_lifecycle: nil, slow_threshold: 1.5) ⇒ Result
Executes best-effort local cleanup once.
This path is intended for connection disruption after critical game I/O has already stopped or become unreliable. It avoids closing the game socket itself and does not describe script hooks as graceful.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'documented/common/best_effort_shutdown_cleanup.rb', line 53 def run(coordinator:, initial_scripts:, remaining_scripts:, script_drain:, vars:, active_sessions_lifecycle: nil, slow_threshold: 1.5) validate!(coordinator: coordinator, remaining_scripts: remaining_scripts, script_drain: script_drain, vars: vars) result = Result.new( completed: false, failures: [], scripts_drained: false, vars_saved: false ) stored_result = coordinator.begin_best_effort_cleanup(result) return stored_result unless stored_result.equal?(result) log_info("best-effort shutdown cleanup starting reason=#{coordinator.reason || :unknown}") update_active_sessions(result, active_sessions_lifecycle) drain_scripts(result, initial_scripts, remaining_scripts, script_drain, slow_threshold) save_vars(result, vars) finish(result) end |