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

Method JobRetry

riverdriver/riversqlite/river_sqlite_driver.go:697–726  ·  view source on GitHub ↗
(ctx context.Context, params *riverdriver.JobRetryParams)

Source from the content-addressed store, hash-verified

695}
696
697func (e *Executor) JobRetry(ctx context.Context, params *riverdriver.JobRetryParams) (*rivertype.JobRow, error) {
698 // Unlike Postgres, this must be carried out in two operations because
699 // SQLite doesn't support CTEs containing `UPDATE`. As long as the job
700 // exists and is not running, only one database operation is needed, but if
701 // the initial update comes back empty, it does one more fetch to return the
702 // most appropriate error.
703 return dbutil.WithTxV(ctx, e, func(ctx context.Context, execTx riverdriver.ExecutorTx) (*rivertype.JobRow, error) {
704 dbtx := templateReplaceWrapper{dbtx: e.driver.UnwrapTx(execTx), replacer: &e.driver.replacer}
705
706 job, err := dbsqlc.New().JobRetry(schemaTemplateParam(ctx, params.Schema), dbtx, &dbsqlc.JobRetryParams{
707 ID: params.ID,
708 Now: timeStringNullable(params.Now),
709 })
710 if err != nil {
711 if errors.Is(err, sql.ErrNoRows) {
712 job, err := execTx.JobGetByID(ctx, &riverdriver.JobGetByIDParams{
713 ID: params.ID,
714 Schema: params.Schema,
715 })
716 if err != nil {
717 return nil, interpretError(err)
718 }
719 return job, nil
720 }
721
722 return nil, interpretError(err)
723 }
724 return jobRowFromInternal(job)
725 })
726}
727
728func (e *Executor) JobSchedule(ctx context.Context, params *riverdriver.JobScheduleParams) ([]*riverdriver.JobScheduleResult, error) {
729 // This operation diverges the most from the Postgres version out of all the

Callers

nothing calls this directly

Implementers 3

Executorriverdriver/riverpgxv5/river_pgx_v5_dr
Executorriverdriver/riverdatabasesql/river_dat
Executorriverdriver/riversqlite/river_sqlite_d

Calls 10

WithTxVFunction · 0.92
NewFunction · 0.92
timeStringNullableFunction · 0.85
schemaTemplateParamFunction · 0.70
interpretErrorFunction · 0.70
jobRowFromInternalFunction · 0.70
UnwrapTxMethod · 0.65
JobRetryMethod · 0.65
JobGetByIDMethod · 0.65
IsMethod · 0.45

Tested by

no test coverage detected