MCPcopy Index your code
hub / github.com/riverqueue/river / ResumableSetStepCursorTx

Function ResumableSetStepCursorTx

resumable_step_tx.go:45–52  ·  view source on GitHub ↗

ResumableSetStepCursorTx immediately persists the current resumable step and cursor as part of transaction tx. If tx is rolled back, the step and cursor update will be as well. Normally, a resumable job's step progress is recorded after it runs along with its result status. This is normally suffici

(ctx context.Context, tx TTx, job *Job[TArgs], cursor TCursor)

Source from the content-addressed store, hash-verified

43// Must be called from within a ResumableStepCursor callback. The current step
44// name to persist is read from context.
45func ResumableSetStepCursorTx[TDriver riverdriver.Driver[TTx], TTx any, TArgs JobArgs, TCursor any](ctx context.Context, tx TTx, job *Job[TArgs], cursor TCursor) (*Job[TArgs], error) {
46 cursorBytes, err := json.Marshal(cursor)
47 if err != nil {
48 return nil, err
49 }
50
51 return resumableSetStepTx(ctx, tx, job, json.RawMessage(cursorBytes))
52}
53
54func resumableSetStepTx[TTx any, TArgs JobArgs](ctx context.Context, tx TTx, job *Job[TArgs], cursor json.RawMessage) (*Job[TArgs], error) {
55 if job.State != rivertype.JobStateRunning {

Callers 1

TestResumableSetStepTxFunction · 0.85

Calls 1

resumableSetStepTxFunction · 0.85

Tested by 1

TestResumableSetStepTxFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…