From b5ad101d3fa08e36ce18092954d3d5c0ef1d9bc1 Mon Sep 17 00:00:00 2001 From: Per Stark Date: Fri, 22 Nov 2024 12:33:47 +0100 Subject: [PATCH] moved entry points to bin to clarify --- Cargo.lock | 1 - Cargo.toml | 7 +++---- src/{ => bin}/server.rs | 0 src/{consumer.rs => bin/worker.rs} | 0 src/ingress/content_processor.rs | 8 ++++++++ src/rabbitmq/consumer.rs | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) rename src/{ => bin}/server.rs (100%) rename src/{consumer.rs => bin/worker.rs} (100%) diff --git a/Cargo.lock b/Cargo.lock index 8d6caa0..4688457 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5387,7 +5387,6 @@ dependencies = [ "axum", "axum_typed_multipart", "futures", - "futures-lite 2.3.0", "lapin", "mime", "mime_guess", diff --git a/Cargo.toml b/Cargo.toml index b4a1a78..3ed05ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ async-openai = "0.24.1" axum = { version = "0.7.5", features = ["multipart", "macros"] } axum_typed_multipart = "0.12.1" futures = "0.3.31" -futures-lite = "2.3.0" lapin = { version = "2.5.0", features = ["serde_json"] } mime = "0.3.17" mime_guess = "2.0.5" @@ -29,8 +28,8 @@ uuid = { version = "1.10.0", features = ["v4", "serde"] } [[bin]] name = "server" -path = "src/server.rs" +path = "src/bin/server.rs" [[bin]] -name = "consumer" -path = "src/consumer.rs" +name = "worker" +path = "src/bin/worker.rs" diff --git a/src/server.rs b/src/bin/server.rs similarity index 100% rename from src/server.rs rename to src/bin/server.rs diff --git a/src/consumer.rs b/src/bin/worker.rs similarity index 100% rename from src/consumer.rs rename to src/bin/worker.rs diff --git a/src/ingress/content_processor.rs b/src/ingress/content_processor.rs index 57ff233..4e74aea 100644 --- a/src/ingress/content_processor.rs +++ b/src/ingress/content_processor.rs @@ -1,3 +1,5 @@ +use std::time::Instant; + use text_splitter::TextSplitter; use tracing::{debug, info}; @@ -35,11 +37,17 @@ impl ContentProcessor { // Store original content store_item(&self.db_client, content.clone()).await?; + let now = Instant::now(); // Process in parallel where possible let (analysis, _similar_chunks) = tokio::try_join!( self.perform_semantic_analysis(content), self.find_similar_content(content), )?; + let end = now.elapsed(); + info!( + "{:?} time elapsed during creation of entities and relationships", + end + ); // Convert and store entities let (entities, relationships) = analysis diff --git a/src/rabbitmq/consumer.rs b/src/rabbitmq/consumer.rs index 5f2827c..30d749f 100644 --- a/src/rabbitmq/consumer.rs +++ b/src/rabbitmq/consumer.rs @@ -1,4 +1,4 @@ -use futures_lite::stream::StreamExt; +use futures::StreamExt; use lapin::{message::Delivery, options::*, types::FieldTable, Channel, Consumer, Queue}; use crate::{