Skip to content

Commit

Permalink
fix: use correct signal on *nix
Browse files Browse the repository at this point in the history
  • Loading branch information
egelja authored Sep 6, 2023
1 parent edf9c08 commit a5479b7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/web/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ Session::Session(uv_loop_t* event_loop) :
uv_signal_start(

Check warning on line 83 in src/web/session.cpp

View check run for this annotation

Codecov / codecov/patch

src/web/session.cpp#L83

Added line #L83 was not covered by tests
&break_signal_,
[](auto* handle, int signum) {

Check warning on line 85 in src/web/session.cpp

View check run for this annotation

Codecov / codecov/patch

src/web/session.cpp#L85

Added line #L85 was not covered by tests
#ifdef _WIN32
assert(signum == SIGBREAK);
#else
assert(signum == SIGUSR1);

Check warning on line 89 in src/web/session.cpp

View check run for this annotation

Codecov / codecov/patch

src/web/session.cpp#L89

Added line #L89 was not covered by tests
#endif
auto* session = static_cast<Session*>(handle->data);

Check warning on line 91 in src/web/session.cpp

View check run for this annotation

Codecov / codecov/patch

src/web/session.cpp#L91

Added line #L91 was not covered by tests

log_w(web, "Received SIGBREAK, printing metrics");
log_w(web, "Received SIGBREAK or SIGUSR1, printing metrics");

Check warning on line 93 in src/web/session.cpp

View check run for this annotation

Codecov / codecov/patch

src/web/session.cpp#L93

Added line #L93 was not covered by tests

log_i(

Check warning on line 95 in src/web/session.cpp

View check run for this annotation

Codecov / codecov/patch

src/web/session.cpp#L95

Added line #L95 was not covered by tests
web, "Idle time: {:L}ms", uv_metrics_idle_time(session->loop_) / 1000000
Expand All @@ -95,7 +99,11 @@ Session::Session(uv_loop_t* event_loop) :
log_i(web, "Processed events: {}", session->metrics_.events);
log_i(web, "Waiting events: {}", session->metrics_.events_waiting);
},

Check warning on line 101 in src/web/session.cpp

View check run for this annotation

Codecov / codecov/patch

src/web/session.cpp#L98-L101

Added lines #L98 - L101 were not covered by tests
#ifdef _WIN32
SIGBREAK
#else
SIGUSR1
#endif
);

// Enable metrics
Expand Down

0 comments on commit a5479b7

Please sign in to comment.