Skip to content

Commit

Permalink
Merge pull request #5 from isankadn/Isanka-patch-b3ccf69
Browse files Browse the repository at this point in the history
na
  • Loading branch information
isankadn authored Mar 19, 2024
2 parents d2c905a + 9d5137b commit 7a880a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ FROM rust:slim
WORKDIR /app

COPY --from=builder /app/target/release/mongo-to-clickhouse .
COPY config-prod.yml ./config-prod.yml
COPY config-dev.yml ./config-dev.yml

ENV RUST_ENV=prod
ENV RUSTFLAGS="-C target-cpu=native"

ENV RUST_ENV=prod
CMD ["./mongo-to-clickhouse"]
6 changes: 6 additions & 0 deletions pg_init.psql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE resume_token (
id SERIAL PRIMARY KEY,
token BYTEA UNIQUE,
tenant_name VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ async fn process_tenant_records(
pool_index: usize,
) -> Result<()> {
let mongo_client = MongoClient::with_uri_str(&tenant_config.mongo_uri).await?;
// println!("<<-- mongo_uri {:?}", &tenant_config.mongo_uri);
println!("<<-- mongo_uri {:?}", &tenant_config.mongo_uri);
// println!("<<-- mongo_client {:?}", mongo_client);
let mongo_db = mongo_client.database(&tenant_config.mongo_db);
println!("<<-- mongo_db: {:?}", mongo_db);
let mongo_collection: mongodb::Collection<Document> =
mongo_db.collection(&tenant_config.mongo_collection);

Expand All @@ -104,7 +105,7 @@ async fn process_tenant_records(
let mut change_stream = mongo_collection.watch(None, change_stream_options).await?;

while let Some(result) = change_stream.next().await {
// println!(">>--- Change event: {:?}", result);
println!(">>--- Change event: {:?}", result);
match result {
Ok(change_event) => {
if let ChangeStreamEvent {
Expand Down

0 comments on commit 7a880a1

Please sign in to comment.