fix(render): node reports progress → moving bar + ETA (was stuck 0%/Preparing)
Build backend images / build content-svc (push) Failing after 58s
Build backend images / build file-svc (push) Failing after 45s
Build backend images / build gateway (push) Failing after 52s
Build backend images / build identity-svc (push) Failing after 54s
Build backend images / build notification-svc (push) Failing after 56s
Build backend images / build render-svc (push) Failing after 56s
Build backend images / build studio-svc (push) Failing after 49s
Build backend images / build content-svc (push) Failing after 58s
Build backend images / build file-svc (push) Failing after 45s
Build backend images / build gateway (push) Failing after 52s
Build backend images / build identity-svc (push) Failing after 54s
Build backend images / build notification-svc (push) Failing after 56s
Build backend images / build render-svc (push) Failing after 56s
Build backend images / build studio-svc (push) Failing after 49s
The node's onProgress callback only LOGGED — it never POSTed, so render_progress stayed
0 and step stayed Preparing (no bar, no ETA). Add render-svc POST
/v1/internal/render/jobs/{id}/progress (UpdateJobProgress: set render_progress + bump
step Queued/Preparing→Rendering once >0) + client UpdateProgress + wire onProgress to
post it (8s best-effort timeout, AE-CPU/DB-starvation tolerant). Preview already posts;
real-frame preview is epic C.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -445,6 +445,13 @@ func (a *Agent) runJob(ctx context.Context, job *client.ClaimedJob) {
|
||||
|
||||
onProgress := func(ctx context.Context, pct int, msg string) error {
|
||||
log.Printf("[job %s] %d%% %s", job.JobID, pct, msg)
|
||||
// Report to the orchestrator so the UI shows a moving bar + ETA (best-effort,
|
||||
// short timeout — AE pegs CPU so the DB may be slow on a single-box dev setup).
|
||||
pCtx, cancel := context.WithTimeout(ctx, 8*time.Second)
|
||||
defer cancel()
|
||||
if err := a.orch.UpdateProgress(pCtx, job.JobID, pct); err != nil {
|
||||
log.Printf("[job %s] progress push error: %v", job.JobID, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -357,6 +357,22 @@ func (c *Client) UpdatePreview(ctx context.Context, jobID, imageB64 string) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateProgress reports the render percentage so the UI shows a moving bar + ETA.
|
||||
// Errors are non-fatal — the UI just won't advance.
|
||||
func (c *Client) UpdateProgress(ctx context.Context, jobID string, percent int) error {
|
||||
resp, err := c.do(ctx, http.MethodPost,
|
||||
fmt.Sprintf("/v1/internal/render/jobs/%s/progress", jobID),
|
||||
map[string]int{"progress": percent})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode >= 300 {
|
||||
return fmt.Errorf("progress: HTTP %d", resp.StatusCode)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOutputUploadURL asks the orchestrator to allocate an Export row and
|
||||
// return a presigned MinIO PUT URL for the rendered output file.
|
||||
func (c *Client) GetOutputUploadURL(ctx context.Context, jobID string) (*OutputUploadURLResponse, error) {
|
||||
|
||||
Reference in New Issue
Block a user