pub fn main_okk<F, Fut>(f: F) -> !
Expand description
Start RisingWave components with configs from environment variable.
§Shutdown on Ctrl-C
The given closure f
will take a [CancellationToken
] as an argument. When a SIGINT
signal
is received (typically by pressing Ctrl-C
), [CancellationToken::cancel
] will be called to
notify all subscribers to shutdown. You can use .cancelled()
to get notified on this.
Users may also send a second SIGINT
signal to force shutdown. In this case, this function
will exit the process with a non-zero exit code.
When f
returns, this function will assume that the component has finished its work and it’s
safe to exit. Therefore, this function will exit the process with exit code 0 without
waiting for background tasks to finish. In other words, it’s the responsibility of f
to
ensure that all essential background tasks are finished before returning.
§Environment variables
Currently, the following environment variables will be read and used to configure the runtime.
RW_WORKER_THREADS
(alias ofTOKIO_WORKER_THREADS
): number of tokio worker threads. If not set, it will be decided by tokio. Note that this can still be overridden by per-module runtime worker thread settings in the config file.RW_DEADLOCK_DETECTION
: whether to enable deadlock detection. If not set, will enable in debug mode, and disable in release mode.RW_PROFILE_PATH
: the path to generate flamegraph. If set, then profiling is automatically enabled.