MCPcopy Create free account
hub / github.com/pydio/cells / Run

Method Run

common/sync/task/sync.go:175–204  ·  view source on GitHub ↗

Run runs the sync with panic recovery

(ctx context.Context, dryRun bool, force bool)

Source from the content-addressed store, hash-verified

173
174// Run runs the sync with panic recovery
175func (s *Sync) Run(ctx context.Context, dryRun bool, force bool) (model.Stater, error) {
176 var err error
177 defer func() {
178 if e := recover(); e != nil {
179 fmt.Println("stacktrace from panic: \n" + string(debug.Stack()))
180 if er, ok := e.(error); ok {
181 err = er
182 if s.statuses != nil {
183 s.statuses <- model.NewProcessingStatus(err.Error()).SetError(err).SetProgress(1)
184 }
185 if s.runDone != nil {
186 s.runDone <- 0
187 }
188 }
189 }
190 }()
191
192 stater, err := s.run(ctx, dryRun, force)
193 if err != nil && s.statuses != nil {
194 s.statuses <- model.NewProcessingStatus(err.Error()).SetError(err).SetProgress(1)
195 if s.runDone != nil {
196 if stater != nil {
197 s.runDone <- stater
198 } else {
199 s.runDone <- 0
200 }
201 }
202 }
203 return stater, err
204}
205
206func (s *Sync) ReApplyPatch(ctx context.Context, patch merger.Patch) {
207 patch.SkipFilterToTarget(false)

Callers 1

FlatSyncSnapshotMethod · 0.95

Calls 6

runMethod · 0.95
NewProcessingStatusFunction · 0.92
PrintlnMethod · 0.80
ErrorMethod · 0.65
SetProgressMethod · 0.45
SetErrorMethod · 0.45

Tested by

no test coverage detected