Ensure _cmd_apply restarts service on failure#179
Conversation
Wrap the apply step sequence in try/finally so _start_service is always called after the service was stopped, even if a step fails. Previously, any exception between stop and start left the bot offline until manual restart. The inner try/except around _start_service in the finally block prevents a start failure from masking the original exception. Fixes #166
Review by KaiReview:
|
Review by KaiReview:
|
Summary
Wrap the apply step sequence in
try/finallyso the service is always restarted after being stopped, even if a step fails. Previously, any exception between_stop_serviceand_start_serviceleft the bot offline until manual restart.The problem
The fix
The inner
try/exceptaround_start_servicein thefinallyblock prevents a start failure from masking the original exception. Without it, Python would replace the propagating exception with the start error, hiding the actual cause.Test plan
make checkcleanFixes #166