Skip to content

Commit

Permalink
Trying a background_jobs fix. #1820 (#1822)
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines authored Oct 8, 2021
1 parent e06cd9c commit 53a2b6d
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 98 deletions.
183 changes: 91 additions & 92 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ async-trait = "0.1.51"
captcha = "0.0.8"
anyhow = "1.0.44"
thiserror = "1.0.29"
background-jobs = "0.10.0"
background-jobs = "0.9.0"
reqwest = { version = "0.11.4", features = ["json"] }
2 changes: 1 addition & 1 deletion crates/api_crud/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ sha2 = "0.9.8"
async-trait = "0.1.51"
anyhow = "1.0.44"
thiserror = "1.0.29"
background-jobs = "0.10.0"
background-jobs = "0.9.0"
reqwest = { version = "0.11.4", features = ["json"] }
webmention = "0.4.0"
1 change: 1 addition & 0 deletions crates/apub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ sha2 = "0.9.8"
async-trait = "0.1.51"
anyhow = "1.0.44"
thiserror = "1.0.29"
background-jobs = "0.9.0"
reqwest = { version = "0.11.4", features = ["json"] }

2 changes: 1 addition & 1 deletion crates/apub_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ sha2 = "0.9.8"
actix-web = { version = "4.0.0-beta.9", default-features = false }
http-signature-normalization-actix = { version = "0.5.0-beta.10", default-features = false, features = ["server", "sha-2"] }
http-signature-normalization-reqwest = { version = "0.2.0", default-features = false, features = ["sha-2"] }
background-jobs = "0.10.0"
background-jobs = "0.9.0"
3 changes: 2 additions & 1 deletion crates/apub_lib/src/activity_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ async fn do_send(task: SendActivityTask, client: &Client) -> Result<(), Error> {
pub fn create_activity_queue() -> QueueHandle {
// Start the application server. This guards access to to the jobs store
let queue_handle = create_server(Storage::new());
let arbiter = actix_web::rt::Arbiter::new();

// Configure and start our workers
WorkerConfig::new(|| MyState {
client: Client::default(),
})
.register::<SendActivityTask>()
.start(queue_handle.clone());
.start_in_arbiter(&arbiter, queue_handle.clone());

queue_handle
}
Expand Down
2 changes: 1 addition & 1 deletion crates/websocket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ serde_json = { version = "1.0.68", features = ["preserve_order"] }
actix = "0.12.0"
anyhow = "1.0.44"
diesel = "1.4.8"
background-jobs = "0.10.0"
background-jobs = "0.9.0"
tokio = "1.12.0"
strum = "0.21.0"
strum_macros = "0.21.1"
Expand Down
3 changes: 2 additions & 1 deletion src/scheduled_tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ pub fn setup(pool: DbPool) {
active_counts(&conn);

// On startup, reindex the tables non-concurrently
reindex_aggregates_tables(&conn, false);
// TODO remove this for now, since it slows down startup a lot on lemmy.ml
reindex_aggregates_tables(&conn, true);
scheduler.every(1.hour()).run(move || {
active_counts(&conn);
reindex_aggregates_tables(&conn, true);
Expand Down

0 comments on commit 53a2b6d

Please sign in to comment.