mirror of
https://github.com/TabbyML/tabby
synced 2024-11-22 00:08:06 +00:00
chore(webserver): set apalis poll interval to 5 seconds (#2246)
* chore(webserver): set apalis poll interval to 1 seconds * update * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
443e1f91f9
commit
b6e00d9820
90
Cargo.lock
generated
90
Cargo.lock
generated
@ -138,8 +138,8 @@ checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3"
|
||||
|
||||
[[package]]
|
||||
name = "apalis"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/wsxiaoys/apalis?rev=91526e8#91526e811607ec72ab83583547c0e8005c24d394"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/geofmureithi/apalis?rev=f63480c#f63480c3b53682ae29ec7e6c28757709e8c6e6ac"
|
||||
dependencies = [
|
||||
"apalis-core",
|
||||
"apalis-cron",
|
||||
@ -157,24 +157,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "apalis-core"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/wsxiaoys/apalis?rev=91526e8#91526e811607ec72ab83583547c0e8005c24d394"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/geofmureithi/apalis?rev=f63480c#f63480c3b53682ae29ec7e6c28757709e8c6e6ac"
|
||||
dependencies = [
|
||||
"async-oneshot",
|
||||
"futures",
|
||||
"futures-timer",
|
||||
"pin-project-lite",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tower",
|
||||
"ulid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "apalis-cron"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/wsxiaoys/apalis?rev=91526e8#91526e811607ec72ab83583547c0e8005c24d394"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/geofmureithi/apalis?rev=f63480c#f63480c3b53682ae29ec7e6c28757709e8c6e6ac"
|
||||
dependencies = [
|
||||
"apalis-core",
|
||||
"async-stream",
|
||||
@ -186,8 +186,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "apalis-redis"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/wsxiaoys/apalis?rev=91526e8#91526e811607ec72ab83583547c0e8005c24d394"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/geofmureithi/apalis?rev=f63480c#f63480c3b53682ae29ec7e6c28757709e8c6e6ac"
|
||||
dependencies = [
|
||||
"apalis-core",
|
||||
"async-stream",
|
||||
@ -202,8 +202,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "apalis-sql"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/wsxiaoys/apalis?rev=91526e8#91526e811607ec72ab83583547c0e8005c24d394"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/geofmureithi/apalis?rev=f63480c#f63480c3b53682ae29ec7e6c28757709e8c6e6ac"
|
||||
dependencies = [
|
||||
"apalis-core",
|
||||
"async-stream",
|
||||
@ -661,9 +661,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.31"
|
||||
version = "0.4.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
||||
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
@ -671,7 +671,7 @@ dependencies = [
|
||||
"num-traits",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
"windows-targets 0.48.0",
|
||||
"windows-targets 0.52.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1505,9 +1505,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.28"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"
|
||||
checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@ -1520,9 +1520,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.29"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb"
|
||||
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
@ -1530,15 +1530,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.29"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
|
||||
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.28"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
|
||||
checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
@ -1558,9 +1558,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.29"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa"
|
||||
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
|
||||
|
||||
[[package]]
|
||||
name = "futures-lite"
|
||||
@ -1577,9 +1577,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.29"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
|
||||
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -1597,27 +1597,27 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.29"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817"
|
||||
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.29"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2"
|
||||
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
|
||||
|
||||
[[package]]
|
||||
name = "futures-timer"
|
||||
version = "3.0.2"
|
||||
version = "3.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"
|
||||
checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.29"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104"
|
||||
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@ -2794,9 +2794,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.20"
|
||||
version = "0.4.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||
|
||||
[[package]]
|
||||
name = "loom"
|
||||
@ -3772,9 +3772,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.13"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
@ -5567,6 +5567,7 @@ version = "0.12.0-dev.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"apalis",
|
||||
"apalis-sql",
|
||||
"argon2",
|
||||
"assert_matches",
|
||||
"async-trait",
|
||||
@ -6151,11 +6152,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.37"
|
||||
version = "0.1.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
@ -6164,9 +6164,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.24"
|
||||
version = "0.1.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74"
|
||||
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -6175,9 +6175,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.31"
|
||||
version = "0.1.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a"
|
||||
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"valuable",
|
||||
|
@ -40,7 +40,7 @@ tantivy = { git = "https://github.com/quickwit-oss/tantivy", rev = "b806122" }
|
||||
async-trait = "0.1.72"
|
||||
reqwest = { version = "0.12" }
|
||||
derive_builder = "0.12.0"
|
||||
futures = "0.3.28"
|
||||
futures = "0.3.30"
|
||||
async-stream = "0.3.5"
|
||||
regex = "1.10.0"
|
||||
strum = { version = "0.24", features = ["derive"] }
|
||||
|
@ -47,7 +47,8 @@ tabby-git = { path = "../../crates/tabby-git" }
|
||||
octocrab = "0.38.0"
|
||||
fs_extra = "1.3.0"
|
||||
gitlab = "0.1610.0"
|
||||
apalis = { git = "https://github.com/wsxiaoys/apalis", rev = "91526e8", features = ["sqlite", "cron" ] }
|
||||
apalis = { git = "https://github.com/geofmureithi/apalis", rev = "f63480c", features = ["sqlite", "cron" ] }
|
||||
apalis-sql = { git = "https://github.com/geofmureithi/apalis", rev = "f63480c" }
|
||||
uuid.workspace = true
|
||||
strum.workspace = true
|
||||
|
||||
|
@ -3,7 +3,7 @@ mod helper;
|
||||
mod scheduler;
|
||||
mod third_party_integration;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
use apalis::{
|
||||
prelude::{Monitor, Storage},
|
||||
@ -44,14 +44,21 @@ pub async fn start(
|
||||
.await
|
||||
.expect("unable to run migrations for sqlite");
|
||||
|
||||
let config = apalis_sql::Config::default().poll_interval(Duration::from_secs(5));
|
||||
let monitor = Monitor::new();
|
||||
let monitor = DbMaintainanceJob::register(monitor, db.clone());
|
||||
let (scheduler, monitor) =
|
||||
SchedulerJob::register(monitor, pool.clone(), db.clone(), repository_access);
|
||||
let (scheduler, monitor) = SchedulerJob::register(
|
||||
monitor,
|
||||
pool.clone(),
|
||||
db.clone(),
|
||||
config.clone(),
|
||||
repository_access,
|
||||
);
|
||||
let (third_party_repository, monitor) = SyncIntegrationJob::register(
|
||||
monitor,
|
||||
pool.clone(),
|
||||
db.clone(),
|
||||
config.clone(),
|
||||
third_party_repository_service,
|
||||
integration_service,
|
||||
);
|
||||
|
@ -6,6 +6,7 @@ use apalis::{
|
||||
sqlite::{SqlitePool, SqliteStorage},
|
||||
utils::TokioExecutor,
|
||||
};
|
||||
use apalis_sql::Config;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tabby_common::config::{RepositoryAccess, RepositoryConfig};
|
||||
@ -81,9 +82,10 @@ impl SchedulerJob {
|
||||
monitor: Monitor<TokioExecutor>,
|
||||
pool: SqlitePool,
|
||||
db: DbConn,
|
||||
config: Config,
|
||||
repository_access: Arc<dyn RepositoryAccess>,
|
||||
) -> (SqliteStorage<SchedulerJob>, Monitor<TokioExecutor>) {
|
||||
let storage = SqliteStorage::new(pool);
|
||||
let storage = SqliteStorage::new_with_config(pool, config);
|
||||
let monitor = monitor
|
||||
.register(Self::basic_worker(storage.clone(), db.clone()).build_fn(Self::run))
|
||||
.register(
|
||||
|
@ -5,6 +5,7 @@ use apalis::{
|
||||
sqlite::{SqlitePool, SqliteStorage},
|
||||
utils::TokioExecutor,
|
||||
};
|
||||
use apalis_sql::Config;
|
||||
use chrono::{DateTime, Utc};
|
||||
use juniper::ID;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -66,10 +67,11 @@ impl SyncIntegrationJob {
|
||||
monitor: Monitor<TokioExecutor>,
|
||||
pool: SqlitePool,
|
||||
db: DbConn,
|
||||
config: Config,
|
||||
repository_service: Arc<dyn ThirdPartyRepositoryService>,
|
||||
integration_service: Arc<dyn IntegrationService>,
|
||||
) -> (SqliteStorage<SyncIntegrationJob>, Monitor<TokioExecutor>) {
|
||||
let storage = SqliteStorage::new(pool);
|
||||
let storage = SqliteStorage::new_with_config(pool, config);
|
||||
let monitor = monitor
|
||||
.register(
|
||||
Self::basic_worker(storage.clone(), db.clone())
|
||||
|
Loading…
Reference in New Issue
Block a user