mirror of
https://git.asonix.dog/asonix/background-jobs.git
synced 2024-11-21 19:40:59 +00:00
Add comments to example
This commit is contained in:
parent
fa395efbae
commit
4d4a70d290
1 changed files with 2 additions and 0 deletions
|
@ -28,6 +28,7 @@ pub struct MyJob {
|
||||||
async fn main() -> Result<(), Error> {
|
async fn main() -> Result<(), Error> {
|
||||||
let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("warn"));
|
let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("warn"));
|
||||||
|
|
||||||
|
// Install the metrics subscriber
|
||||||
let stats_handle = background_jobs::metrics::install()?;
|
let stats_handle = background_jobs::metrics::install()?;
|
||||||
|
|
||||||
tracing_subscriber::fmt::fmt()
|
tracing_subscriber::fmt::fmt()
|
||||||
|
@ -56,6 +57,7 @@ async fn main() -> Result<(), Error> {
|
||||||
actix_rt::spawn(async move {
|
actix_rt::spawn(async move {
|
||||||
loop {
|
loop {
|
||||||
actix_rt::time::sleep(Duration::from_millis(500)).await;
|
actix_rt::time::sleep(Duration::from_millis(500)).await;
|
||||||
|
// Get the current stats for the background jobs processor
|
||||||
println!("{:?}", stats_handle.get());
|
println!("{:?}", stats_handle.get());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue