fee71e7740
Feature/postprocessing * tests * passtest * fixshorttests * mosttests * improvingbasedockerfile * testspeeds * testing * host * canparallel * clean * passfullsuite * singlepagemax * test * findfeatures * findstables * tbls * tablestoo * tablestoo * lateraltests * tableloc * cleanup * inlinetable * childids * cleanup * tests
41 lines
631 B
Go
41 lines
631 B
Go
package docsyncrunner
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
|
|
documentsync "queryorchestration/internal/document/sync"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const Name = "docSyncRunner"
|
|
|
|
type Services struct {
|
|
Document *documentsync.Service
|
|
}
|
|
|
|
type Runner struct {
|
|
svc *Services
|
|
}
|
|
|
|
func New(svc *Services) Runner {
|
|
return Runner{
|
|
svc: svc,
|
|
}
|
|
}
|
|
|
|
type Body struct {
|
|
DocumentID uuid.UUID `json:"id" validate:"required,uuid"`
|
|
}
|
|
|
|
func (s Runner) Process(ctx context.Context, body Body) bool {
|
|
err := s.svc.Document.Sync(ctx, body.DocumentID)
|
|
if err != nil {
|
|
slog.Error("unable to process", "error", err)
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|