You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cluster.rs
    path of file: ./repos/turn-rs/turn-balance/src
    
    the code of the file until where you have to start completion: use std::{
    net::SocketAddr,
    sync::{Arc, Mutex},
    time::{Duration, Instant},
};

use ahash::AHashMap;
use tokio::time::sleep;

use crate::config::Config;

pub struct Node {
    online: bool,
    timer: Instant,
}

pub struct Cluster(Mutex<AHashMap<SocketAddr, Node>>);

impl Cluster {
    pub fn new(cfg: Arc<Config>) -> Arc<Self> {
        let mut nodes = AHashMap::with_capacity(cfg.cluster.nodes.len());
        for item in &cfg.cluster.nodes {
            nodes.insert(
                *item,
                Node {
                    tim
    
    pub fn new(cfg: Arc<Config>) -> Arc<Self> {
        let mut nodes = AHashMap::with_capacity(cfg.cluster.nodes.len());
        for item in &cfg.cluster.nodes {
            nodes.insert(
                *item,
                Node {
                    timer: Instant::now(),
                    online: false,
                },
            );
        }

        let this = Arc::new(Self(Mutex::new(nodes)));
        let this_ = this.clone();
        tokio::spawn(async move {
            loop {
                sleep(Duration::from_secs(10)).await;
                for (addr, item) in this_.0.lock().unwrap().iter_mut() {
                    if item.online && item.timer.elapsed().as_secs() >= 15 {
                        log::info!("node offline: addr={}", addr);
                        item.online = false;
                    }
                }
            }
        });

        this
    }