1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Mainly load testing based
//use crate::{context, queue};
//use ackorelic::newrelic_fn::{nr_end_custom_segment, nr_start_custom_segment};
//use std::thread;
//use std::time::Duration;
//use threadpool;
//
//fn create_segment() {
// let mut count = 0;
// let pool = threadpool::ThreadPool::new(5);
// for _ in 0..1000 {
// count += 1;
// pool.execute(move || {
// let segment = nr_start_custom_segment("segment_id");
// thread::sleep(Duration::from_secs(2));
// nr_end_custom_segment(segment);
// });
// }
// thread::sleep(Duration::from_secs(2));
// println!("Count :: {}", count);
//}
//
//#[test]
//fn load_test_create_context() {
// let pool = threadpool::ThreadPool::new(5);
// for _ in 0..10 {
// pool.execute(move || {
// context::create_context(
// "test_context".to_string(),
// Box::new(queue::DemoQueue {
// name: "api_testing".to_string(),
// }),
// );
// create_segment();
// context::end_context();
// });
// thread::sleep(Duration::from_millis(500));
// }
//}