forked from mtusi2026/mtusi2026lab5
feat(lab5): time pipeline stages and centralize variant constants
This commit is contained in:
@@ -124,7 +124,6 @@ func (w *Worker) Handle(ctx context.Context, message model.Job) error {
|
||||
return w.handleFailure(ctx, claim, err, log)
|
||||
}
|
||||
|
||||
log.Info("attachment ready")
|
||||
if w.cfg.CrashAfterEffect {
|
||||
// Deterministic fault injection for the "written but not acked" window.
|
||||
// The unacked delivery is redelivered after the connection dies.
|
||||
@@ -191,7 +190,7 @@ func (w *Worker) process(ctx context.Context, claim store.ClaimResult, log *slog
|
||||
return &pipeline.Failure{Permanent: true, Code: "staging_corrupt", Err: errors.New("staged checksum mismatch")}
|
||||
}
|
||||
|
||||
encoded, err := w.pipeline.Process(ctx, file)
|
||||
encoded, stats, err := w.pipeline.Process(ctx, file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -229,6 +228,17 @@ func (w *Worker) process(ctx context.Context, claim store.ClaimResult, log *slog
|
||||
return nil
|
||||
}
|
||||
|
||||
// The timing line is the experiment's source for compression overhead. It
|
||||
// is emitted only after the ready snapshot commits, so a redelivered job
|
||||
// cannot produce two successful samples.
|
||||
log.Info("attachment ready",
|
||||
"decode_us", stats.Decode.Microseconds(),
|
||||
"scale_us", stats.Scale.Microseconds(),
|
||||
"jpeg_encode_us", stats.JPEGEncode.Microseconds(),
|
||||
"webp_encode_us", stats.WebPEncode.Microseconds(),
|
||||
"pipeline_us", stats.Total().Microseconds(),
|
||||
)
|
||||
|
||||
// Staging is removed only after ready commits. A crash before this delete
|
||||
// leaves an object the reconciler will clean after retention.
|
||||
if err = w.objects.Delete(ctx, att.StagingKey); err != nil && !errors.Is(err, objectstore.ErrNotFound) {
|
||||
|
||||
Reference in New Issue
Block a user