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
39 lines
597 B
Go
39 lines
597 B
Go
package clientsyncrunner
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
|
|
clientsync "queryorchestration/internal/client/sync"
|
|
)
|
|
|
|
const Name = "clientSyncRunner"
|
|
|
|
type Services struct {
|
|
ClientSync *clientsync.Service
|
|
}
|
|
|
|
type Runner struct {
|
|
svc *Services
|
|
}
|
|
|
|
func New(svc *Services) Runner {
|
|
return Runner{
|
|
svc: svc,
|
|
}
|
|
}
|
|
|
|
type Body struct {
|
|
ClientID string `json:"id" validate:"required"`
|
|
}
|
|
|
|
func (s *Runner) Process(ctx context.Context, body Body) bool {
|
|
err := s.svc.ClientSync.Sync(ctx, body.ClientID)
|
|
if err != nil {
|
|
slog.Error("unable to process", "error", err)
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|