Skip to content

Commit

Permalink
Avoid check of service type in process_service::exec_succeeded
Browse files Browse the repository at this point in the history
The only subclass is bgproc_service, and we can just override the
function - so do that instead.
  • Loading branch information
davmac314 committed Feb 9, 2025
1 parent d4f7a7c commit f349b88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/includes/proc-service.h
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ class process_service : public base_process_service
class bgproc_service : public process_service
{
virtual void handle_exit_status() noexcept override;
virtual void exec_succeeded() noexcept override;
virtual void exec_failed(run_proc_err errcode) noexcept override;

enum class pid_result_t {
Expand Down
10 changes: 6 additions & 4 deletions src/proc-service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ std::vector<const char *> separate_args(ha_string &s,

void process_service::exec_succeeded() noexcept
{
if (get_type() != service_type_t::PROCESS) {
return;
}

tracking_child = true;

// This could be a smooth recovery (state already STARTED). No need to do anything here in
Expand Down Expand Up @@ -83,6 +79,12 @@ void process_service::exec_succeeded() noexcept
}
}

void bgproc_service::exec_succeeded() noexcept
{
// For bgproc service, unlike regular process service, successful execution doesn't mean much;
// the process has to terminate (after forking) before we consider it started.
}

void scripted_service::exec_succeeded() noexcept
{
// For a scripted service, this means nothing other than that the start/stop
Expand Down

0 comments on commit f349b88

Please sign in to comment.