about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2024-05-31 00:12:56 +0200
committerBaitinq <[email protected]>2024-05-31 00:12:56 +0200
commit44d8915afea8d36aa89b7fc694369299159f9a96 (patch)
tree13743fb002b68527afd082d2dd09b72fac25e9d9
parentfs-tracer: create syscall handler (diff)
downloadfs-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.rs19
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);