async fn cooldown_pauses_and_sets_flag() {
        let (handles, _) = setup_requester_test(None).await;

        let requester = Arc::new(Requester {
            handles,
            seen_links: RwLock::new(HashSet::<String>::new()),
            tuning_lock: Mutex::new(0),
            ferox_scan: Arc::new(FeroxScan::default()),
            target_url: "http://localhost".to_string(),
            rate_limiter: RwLock::new(None),
            policy_data: PolicyData::new(RequesterPolicy::AutoBail, 7),
        });

        let start = Instant::now();
        let clone = requester.clone();
        let resp = tokio::task::spawn(async move {
            sleep(Duration::new(1, 0)).await;
            clone.policy_data.cooling_down.load(Ordering::Relaxed)
        });

        requester.cool_down().await;

        assert!(resp.await.unwrap());
        println!("{}", start.elapsed().as_millis());
        assert!(start.elapsed().as_millis() >= 3500);
    }
/// cooldown should pause execution and prevent others calling it by setting cooling_down flag
cooldown should pause execution and prevent others calling it by setting cooling_down flag
cooldown should pause execution and prevent others calling it by setting cooling_down flag
async fn cooldown_pauses_and_sets_flag() {
        let (handles, _) = setup_requester_test(None).await;
        let requester = Arc::new(Requester {
            handles,
            seen_links: RwLock::new(HashSet::<String>::new()),
            tuning_lock: Mutex::new(0),
            ferox_scan: Arc::new(FeroxScan::default()),
            target_url: "http://localhost".to_string(),
            rate_limiter: RwLock::new(None),
            policy_data: PolicyData::new(RequesterPolicy::AutoBail, 7),
        });
        let start = Instant::now();
        let clone = requester.clone();
        let resp = tokio::task::spawn(async move {
            sleep(Duration::new(1, 0)).await;
            clone.policy_data.cooling_down.load(Ordering::Relaxed)
        });
        requester.cool_down().await;
        assert!(resp.await.unwrap());
        println!("{}", start.elapsed().as_millis());
        assert!(start.elapsed().as_millis() >= 3500);
    }
async fn cooldown_pauses_and_sets_flag ( ) { let ( handles , _ ) = setup_requester_test ( None ) . await ; let requester = Arc :: new ( Requester { handles , seen_links : RwLock :: new ( HashSet :: < String > :: new ( ) ) , tuning_lock : Mutex :: new ( 0 ) , ferox_scan : Arc :: new ( FeroxScan :: default ( ) ) , target_url : " " . to_string ( ) , rate_limiter : RwLock :: new ( None ) , policy_data : PolicyData :: new ( RequesterPolicy :: AutoBail , 7 ) , } ) ; let start = Instant :: now ( ) ; let clone = requester . clone ( ) ; let resp = tokio :: task :: spawn ( async move { sleep ( Duration :: new ( 1 , 0 ) ) . await ; clone . policy_data . cooling_down . load ( Ordering :: Relaxed ) } ) ; requester . cool_down ( ) . await ; assert ! ( resp await unwrap ( ) ) ; println ! ( " " start elapsed ( ) as_millis ( ) ) ; assert ! ( start elapsed ( ) as_millis ( ) 3500 ) ; }
cooldown should pause execution and prevent others calling it by setting cooling_down flag
cooldown should pause execution and prevent others calling it by setting cooling_down flag