- inline and signed uploads queue the text job in their transaction - the admin form queues it in the save transaction - detach resyncs the material (its text row goes by cascade) - bm:materials-reindex backfills missing PDF texts before each sync
25 lines
789 B
Go
25 lines
789 B
Go
package console
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.golem15.com/golem15/summercms/modules/bonfire"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// ReindexRun exposes one reindex walk to the console_test package.
|
|
type ReindexRun struct{ r *reindexRun }
|
|
|
|
// NewReindexRun is a walk with deps' Backfill and the given sync.
|
|
func NewReindexRun(deps MaterialsReindexDeps, sync func(id uint) error, out bonfire.Output) ReindexRun {
|
|
return ReindexRun{r: &reindexRun{backfill: deps.Backfill, sync: sync, out: out}}
|
|
}
|
|
|
|
// Material runs the per-material step.
|
|
func (w ReindexRun) Material(ctx context.Context, db *gorm.DB, id uint) { w.r.material(ctx, db, id) }
|
|
|
|
// Counts are the run's counters and the tool-missing flag.
|
|
func (w ReindexRun) Counts() (synced, failed int, noTool bool) {
|
|
return w.r.synced, w.r.failed, w.r.noTool
|
|
}
|