Skip to content

Commit

Permalink
featurizeP
Browse files Browse the repository at this point in the history
  • Loading branch information
thesuzerain committed Jan 14, 2024
1 parent baa5d53 commit 93aa5ae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ lettre = "0.11.3"
derive-new = "0.6.0"
rust_iso3166 = "0.1.11"

jemallocator = "0.3.2"
jemallocator = {version = "0.3.2", optional = true}

[dev-dependencies]
actix-http = "3.4.0"
Expand All @@ -118,3 +118,6 @@ opt-level = 0 # Minimal optimization, speeds up compilation
lto = false # Disables Link Time Optimization
incremental = true # Enables incremental compilation
codegen-units = 16 # Higher number can improve compile times but reduce runtime performance

[features]
jemalloc = ["jemallocator"]
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ COPY docker_utils/dummy.rs .
# Change temporarely the path of the code
RUN sed -i 's|src/main.rs|dummy.rs|' Cargo.toml
# Build only deps
RUN cargo build --release
RUN cargo build --release --features jemalloc
# Now return the file back to normal
RUN sed -i 's|dummy.rs|src/main.rs|' Cargo.toml

# Copy everything
COPY . .
# Build our code
ARG SQLX_OFFLINE=true
RUN cargo build --release
RUN cargo build --release --features jemalloc

# Final Stage
FROM ubuntu:latest
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use labrinth::{check_env_vars, clickhouse, database, file_hosting, queue};
use log::{error, info};
use std::sync::Arc;

#[cfg(feature = "jemalloc")]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

Expand Down
21 changes: 13 additions & 8 deletions src/search/indexing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,19 @@ pub async fn get_indexes_for_indexing(
let client = config.make_client();
let project_name = config.get_index_name("projects", next);
let project_filtered_name = config.get_index_name("projects_filtered", next);
let projects_index = create_or_update_index(&client, &project_name, Some(&[
"words",
"typo",
"proximity",
"attribute",
"exactness",
"sort",
]),).await?;
let projects_index = create_or_update_index(
&client,
&project_name,
Some(&[
"words",
"typo",
"proximity",
"attribute",
"exactness",
"sort",
]),
)
.await?;
let projects_filtered_index = create_or_update_index(
&client,
&project_filtered_name,
Expand Down

0 comments on commit 93aa5ae

Please sign in to comment.