Repository navigation
feat(libs): add libs - #1
Conversation
| /// Bounds on every request to Sentry. Without them an unreachable Sentry holds the process | ||
| /// open at exit for the OS TCP connect timeout (minutes), past `docker stop`'s grace period. | ||
| const SENTRY_CONNECT_TIMEOUT: Duration = Duration::from_secs(2); | ||
| const SENTRY_REQUEST_TIMEOUT: Duration = Duration::from_secs(5); |
There was a problem hiding this comment.
Don't feel like you need to explain in detail (pointing me to the docs would be great), but is the shutdown analogous to fastify's? i.e. when you start shutting down new then connections are rejected with a bad status (503, say) and (depending on config) existing connections get killed at some point?
There was a problem hiding this comment.
The main thing happening here is:
fn main() -> Exit {
// ...stuff that does not matter
// `_sentry` guard created
let _sentry = runtime::telemetry::init(runtime::release!(), &config.telemetry);
runtime::serve(config.listen_addr, app::app())
// `_sentry` guard dropped
}Once _sentry "goes out of scope", the Drop implementation is invoked. If we do not explicitly set Sentry's timeouts, the defaults are used, and this guard is held on for annoyingly long - Docker will force kill, before graceful shutdown.
Refs:
- https://doc.rust-lang.org/rust-by-example/scope/raii.html#destructor
- Short explanation of
Dropas RAII
- Short explanation of
- https://github.com/getsentry/sentry-rust/blob/4b66d3c2c123bd6c6f1be694fce39e1d9c9d8d32/sentry/src/init.rs#L31-L44
- Actual
sentryRust code called
- Actual
As for your actual question, I am not sure this can be compared to Fastify, because this code is part of the CLIENT.
There was a problem hiding this comment.
Okay, thanks. I'm sure this will become clear, but I saw this being used in the server file and so my mind didn't leap to client!
1st in stack
#1
├── #2
├── #3
├── #4
├── #5
├── #6