mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-27 10:46:30 +00:00
remove async/spawn in Collector::collect
This commit is contained in:
@@ -160,10 +160,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tokio::task::spawn(async move {
|
Collector::collect();
|
||||||
let mut stats_collector = Collector::default();
|
|
||||||
stats_collector.collect().await;
|
|
||||||
});
|
|
||||||
|
|
||||||
info!("Config autoreloader: {}", match config.general.autoreload {
|
info!("Config autoreloader: {}", match config.general.autoreload {
|
||||||
Some(interval) => format!("{} ms", interval),
|
Some(interval) => format!("{} ms", interval),
|
||||||
|
|||||||
@@ -77,13 +77,12 @@ impl Reporter {
|
|||||||
/// The statistics collector which used for calculating averages
|
/// The statistics collector which used for calculating averages
|
||||||
/// There is only one collector (kind of like a singleton)
|
/// There is only one collector (kind of like a singleton)
|
||||||
/// it updates averages every 15 seconds.
|
/// it updates averages every 15 seconds.
|
||||||
#[derive(Default)]
|
pub struct Collector;
|
||||||
pub struct Collector {}
|
|
||||||
|
|
||||||
impl Collector {
|
impl Collector {
|
||||||
/// The statistics collection handler. It will collect statistics
|
/// The statistics collection handler. It will collect statistics
|
||||||
/// for `address_id`s starting at 0 up to `addresses`.
|
/// for `address_id`s starting at 0 up to `addresses`.
|
||||||
pub async fn collect(&mut self) {
|
pub fn collect() {
|
||||||
info!("Events reporter started");
|
info!("Events reporter started");
|
||||||
|
|
||||||
tokio::task::spawn(async move {
|
tokio::task::spawn(async move {
|
||||||
|
|||||||
Reference in New Issue
Block a user