mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-16 06:42:14 +00:00
fix keepalive redis in job
This commit is contained in:
1 parent
0f7ff50cf6
commit
af685b37cf
5 files changed
+27
-3
No files matched your search
@@ -3,6 +3,9 @@
|
||||
# NB: For my crapy internet connection
|
||||
BUCKET_TIMEOUT_SECONDS=6000
|
||||
|
||||
# NB: Disable if not testing Redis
|
||||
REDIS_FOR_KEEPALIVE_URL="redis://localhost/0"
|
||||
|
||||
# ================================= #
|
||||
# #
|
||||
# SO-VITS-SVC #
|
||||
|
||||
@@ -24,8 +24,8 @@ pub async fn process_single_job(
|
||||
job: &AvailableInferenceJob,
|
||||
) -> Result<ProcessSingleJobSuccessCase, ProcessSingleJobError> {
|
||||
|
||||
let mut maybe_redis = job_dependencies
|
||||
.maybe_redis_pool
|
||||
let mut maybe_keepalive_redis = job_dependencies
|
||||
.maybe_keepalive_redis_pool
|
||||
.as_ref()
|
||||
.map(|redis| redis.get())
|
||||
.transpose()
|
||||
@@ -98,7 +98,7 @@ pub async fn process_single_job(
|
||||
// ==================== HANDLE KEEPALIVE (OPTIONAL) ==================== //
|
||||
|
||||
if job.is_keepalive_required {
|
||||
match &mut maybe_redis {
|
||||
match &mut maybe_keepalive_redis {
|
||||
None => {
|
||||
warn!("Keepalive is required for this job, but we do not have Redis configured to check!")
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ pub struct JobDependencies {
|
||||
// connect to production Redis easily (requires lots of setup - ghosttunnel or something + IP rules)
|
||||
pub maybe_redis_pool: Option<r2d2::Pool<RedisConnectionManager>>,
|
||||
|
||||
pub maybe_keepalive_redis_pool: Option<r2d2::Pool<RedisConnectionManager>>,
|
||||
|
||||
pub job_progress_reporter: Box<dyn JobProgressReporterBuilder>,
|
||||
|
||||
pub private_bucket_client: BucketClient,
|
||||
|
||||
@@ -206,11 +206,22 @@ async fn main() -> AnyhowResult<()> {
|
||||
}
|
||||
};
|
||||
|
||||
let maybe_keepalive_redis_pool =
|
||||
match easyenv::get_env_string_optional("REDIS_FOR_KEEPALIVE_URL") {
|
||||
None => None,
|
||||
Some(redis_url) => {
|
||||
let redis_manager = RedisConnectionManager::new(redis_url)?;
|
||||
let redis_pool = r2d2::Pool::builder().build(redis_manager)?;
|
||||
Some(redis_pool)
|
||||
}
|
||||
};
|
||||
|
||||
let job_dependencies = JobDependencies {
|
||||
scoped_temp_dir_creator: ScopedTempDirCreator::for_directory(&temp_directory),
|
||||
download_temp_directory: temp_directory,
|
||||
mysql_pool,
|
||||
maybe_redis_pool: None, // TODO(bt, 2023-01-11): See note in JobDependencies
|
||||
maybe_keepalive_redis_pool,
|
||||
job_progress_reporter,
|
||||
public_bucket_client,
|
||||
private_bucket_client,
|
||||
|
||||
@@ -18,3 +18,11 @@ STRIPE_SECRET_WEBHOOK_SIGNING_KEY=whsec_40b60bd75768052532b63dbeefa7a1b163e182c3
|
||||
# Development container
|
||||
NUM_WORKERS=16
|
||||
MYSQL_MAX_CONNECTIONS=50
|
||||
|
||||
# REDIS_0 is used for many things, including:
|
||||
# - generic inference job keepalive / polling / TTL
|
||||
# - (many others I haven't documented yet)
|
||||
REDIS_0_URL="redis://localhost/0"
|
||||
|
||||
# Not sure if REDIS_1 is used anywhere...?
|
||||
#REDIS_1_URL="redis://localhost/1"
|
||||
Reference in new issue
Block a user