diff options
| author | Baitinq <[email protected]> | 2024-05-31 00:12:56 +0200 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2024-05-31 00:12:56 +0200 |
| commit | 44d8915afea8d36aa89b7fc694369299159f9a96 (patch) | |
| tree | 13743fb002b68527afd082d2dd09b72fac25e9d9 | |
| parent | fs-tracer: create syscall handler (diff) | |
| download | fs-tracer-44d8915afea8d36aa89b7fc694369299159f9a96.tar.gz fs-tracer-44d8915afea8d36aa89b7fc694369299159f9a96.tar.bz2 fs-tracer-44d8915afea8d36aa89b7fc694369299159f9a96.zip | |
BATCHING BROKE FS_TRACER EXITING
| -rw-r--r-- | fs-tracer/src/main.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs-tracer/src/main.rs b/fs-tracer/src/main.rs index a6d41b7..4e59469 100644 --- a/fs-tracer/src/main.rs +++ b/fs-tracer/src/main.rs @@ -109,18 +109,19 @@ async fn main() -> Result<(), anyhow::Error> { } info!("Waiting for threads to stop"); + let mut batched_req = vec![]; + let mut i = 0; for elt in resolved_files_recv { - // TODO: Batching. + batched_req.push(elt); + i += 1; + // Batching. + if i % 40 != 0 { + continue; + } + let request_body = format!("[{}]", batched_req.join(",")); let resp = ureq::post(&url) .set("API_KEY", &fs_tracer_api_key) - .send_string(&format!( - r#" - [ - {} - ] - "#, - elt - )) + .send_string(&request_body) .expect("Failed to send request"); if resp.status() != 200 { panic!("Failed to send request: {:?}", resp); |