Skip to content

Commit

Permalink
update minijinja version
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Jul 8, 2023
1 parent e96b9ae commit dbfa486
Show file tree
Hide file tree
Showing 12 changed files with 349 additions and 65 deletions.
372 changes: 326 additions & 46 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ actix-web-lab = "0.19"
actix-ws = "0.2.5"
awc = "3"

chrono = { version = "0.4.20", default-features = false, features = ["clock", "serde"] }
derive_more = "0.99.7"
env_logger = "0.10"
futures-util = { version = "0.3.17", default-features = false, features = ["std"] }
Expand All @@ -95,3 +96,4 @@ rand = "0.8"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1.24.2", features = ["sync"] }
tokio-util = "0.7.4"
2 changes: 1 addition & 1 deletion auth/simple-auth-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ actix-identity.workspace = true
actix-session = { workspace = true, features = ["cookie-session"] }
actix-web.workspace = true

chrono = { version = "0.4.20", features = ["serde"] }
chrono.workspace = true
derive_more.workspace = true
diesel = { version = "2", features = ["postgres", "r2d2", "uuid", "chrono"] }
dotenv = "0.15"
Expand Down
6 changes: 3 additions & 3 deletions background-jobs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ edition = "2021"
actix-web.workspace = true

anyhow = "1"
apalis = { version = "0.3", features = ["redis"] }
chrono = { version = "0.4.20", default-features = false, features = ["clock", "serde"] }
apalis = { version = "0.4", features = ["redis"] }
chrono.workspace = true
dotenv = "0.15"
env_logger.workspace = true
log.workspace = true
rand.workspace = true
serde.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
tokio-util = "0.7.4"
tokio-util.workspace = true
15 changes: 8 additions & 7 deletions background-jobs/src/persistent_jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ impl Job for Email {
const NAME: &'static str = "send_email";
}

async fn process_email_job(job: Email, _ctx: JobContext) -> Result<JobResult, JobError> {
async fn process_email_job(job: Email, _ctx: JobContext) -> Result<(), JobError> {
log::info!("sending email to {}", &job.to);

// simulate time taken to send email
tokio::time::sleep(rand_delay_with_jitter()).await;

Ok(JobResult::Success)
Ok(())
}

pub(crate) async fn start_processing_email_queue() -> anyhow::Result<RedisStorage<Email>> {
Expand All @@ -45,16 +45,17 @@ pub(crate) async fn start_processing_email_queue() -> anyhow::Result<RedisStorag
// create job monitor(s) and attach email job handler
let monitor = Monitor::new().register_with_count(2, {
let storage = storage.clone();
move |_n| WorkerBuilder::new(storage.clone()).build_fn(process_email_job)
move |n| {
WorkerBuilder::new(format!("job-handler-{n}"))
.with_storage(storage.clone())
.build_fn(process_email_job)
}
});

// spawn job monitor into background
// the monitor manages itself otherwise so we don't need to return a join handle
#[allow(clippy::let_underscore_future)]
let _ = tokio::spawn(
// run_without_signals: don't listen for ctrl-c because Actix Web does
monitor.run_without_signals(),
);
let _ = tokio::spawn(monitor.run());

Ok(storage)
}
Expand Down
2 changes: 1 addition & 1 deletion databases/redis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ actix-web.workspace = true
env_logger.workspace = true
futures-util.workspace = true
log.workspace = true
redis = { version = "0.22", default-features = false, features = ["tokio-comp", "connection-manager"] }
redis = { version = "0.23", default-features = false, features = ["tokio-comp", "connection-manager"] }
serde.workspace = true
2 changes: 1 addition & 1 deletion databases/redis/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async fn cache_stuff(
.await
.map_err(error::ErrorInternalServerError)?;

let res = redis::Cmd::set_multiple(&[
let res = redis::Cmd::mset(&[
("my_domain:one", info.one),
("my_domain:two", info.two),
("my_domain:three", info.three),
Expand Down
2 changes: 1 addition & 1 deletion graphql/juniper-advanced/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ actix-cors.workspace = true

juniper = "0.15"

mysql = "23"
mysql = "23" # waiting on r2d2_mysql update
r2d2 = "0.8"
r2d2_mysql = "23"

Expand Down
2 changes: 1 addition & 1 deletion https-tls/awc-https/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ env_logger.workspace = true
log.workspace = true
mime = "0.3"
rustls = "0.20"
webpki-roots = "0.22"
webpki-roots = "0.24"
4 changes: 2 additions & 2 deletions templating/minijinja/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ actix-utils.workspace = true

env_logger.workspace = true
log.workspace = true
minijinja = { version = "0.30", features = ["source"] }
minijinja-autoreload = "0.30"
minijinja = { version = "1", features = ["loader"] }
minijinja-autoreload = "1"
3 changes: 2 additions & 1 deletion templating/minijinja/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use actix_web::{
web, App, FromRequest, HttpRequest, HttpResponse, HttpServer, Responder, Result,
};
use actix_web_lab::respond::Html;
use minijinja::path_loader;
use minijinja_autoreload::AutoReloader;

struct MiniJinjaRenderer {
Expand Down Expand Up @@ -91,7 +92,7 @@ async fn main() -> std::io::Result<()> {
notifier.watch_path(&tmpl_path, true);
}

env.set_source(minijinja::Source::from_path(tmpl_path));
env.set_loader(path_loader(tmpl_path));

Ok(env)
});
Expand Down
2 changes: 1 addition & 1 deletion websockets/chat-tcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ rand.workspace = true
serde.workspace = true
serde_json.workspace = true
tokio = { workspace = true, features = ["full"] }
tokio-util = { version = "0.7", features = ["codec"] }
tokio-util.workspace = true
tokio-stream = "0.1.8"

0 comments on commit dbfa486

Please sign in to comment.