List every photo's open Enhance jobs for a jobs manager
GET /enhance/jobs without a path now answers the jobs manager (FVR #99): every photo's queued / running / unavailable jobs, plus ready / failed / expired ones touched in the last 3 days, newest first, discarded and approved hidden, at most 100. DB only; the poller keeps rows current. An optional status=a,b filter applies to both forms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f121457c43
commit
37a2386458
5 files changed
+156
-8
No files matched your search
@@ -31,6 +31,11 @@ const IDLE_CHECK_EVERY: Duration = Duration::from_secs(30);
|
||||
const JOB_RETENTION_SECS: i64 = 14 * 24 * 3600;
|
||||
/// Jobs shown per photo.
|
||||
pub const JOBS_PER_PHOTO: i64 = 20;
|
||||
/// The jobs manager lists finished-but-unhandled jobs (ready, failed,
|
||||
/// expired) for this long; active ones always.
|
||||
pub const OPEN_JOBS_WINDOW_SECS: i64 = 3 * 24 * 3600;
|
||||
/// Most jobs the jobs manager lists.
|
||||
pub const OPEN_JOBS_LIMIT: i64 = 100;
|
||||
|
||||
pub const MSG_UNAVAILABLE: &str = "ComfyUI isn't running";
|
||||
pub const MSG_EXPIRED: &str = "This result expired (ComfyUI was restarted). Run it again.";
|
||||
@@ -390,6 +395,17 @@ impl EnhanceService {
|
||||
.map_err(|e| EnhanceError::Internal(e.to_string()))
|
||||
}
|
||||
|
||||
/// Every photo's open jobs for the jobs manager, newest first. DB only:
|
||||
/// the poller keeps the rows current, so this never calls ComfyUI.
|
||||
pub fn open_jobs(&self) -> Result<Vec<EnhanceJobRow>, EnhanceError> {
|
||||
let since = chrono::Utc::now().timestamp() - OPEN_JOBS_WINDOW_SECS;
|
||||
self.dao
|
||||
.lock()
|
||||
.unwrap()
|
||||
.list_open(since, OPEN_JOBS_LIMIT)
|
||||
.map_err(|e| EnhanceError::Internal(e.to_string()))
|
||||
}
|
||||
|
||||
/// Distinct recent prompts; DB only, so it works with ComfyUI down.
|
||||
pub fn recent_prompts(
|
||||
&self,
|
||||
|
||||
Reference in new issue
Block a user