MCPcopy
hub / github.com/syncthing/syncthing / setError

Method setError

lib/model/folder.go:1177–1209  ·  view source on GitHub ↗
(ctx context.Context, err error)

Source from the content-addressed store, hash-verified

1175}
1176
1177func (f *folder) setError(ctx context.Context, err error) {
1178 select {
1179 case <-ctx.Done():
1180 return
1181 default:
1182 }
1183
1184 _, _, oldErr := f.getState()
1185 if (err != nil && oldErr != nil && oldErr.Error() == err.Error()) || (err == nil && oldErr == nil) {
1186 return
1187 }
1188
1189 if err != nil {
1190 if oldErr == nil {
1191 f.sl.WarnContext(ctx, "Error on folder", slogutil.Error(err))
1192 } else {
1193 f.sl.InfoContext(ctx, "Folder error changed", slogutil.Error(err), slog.Any("previously", oldErr))
1194 }
1195 } else {
1196 f.sl.InfoContext(ctx, "Folder error cleared")
1197 f.SchedulePull()
1198 }
1199
1200 if f.FSWatcherEnabled {
1201 if err != nil {
1202 f.stopWatch()
1203 } else {
1204 f.scheduleWatchRestart()
1205 }
1206 }
1207
1208 f.stateTracker.setError(err)
1209}
1210
1211func (f *folder) pullBasePause() time.Duration {
1212 if f.PullerPauseS == 0 {

Callers 3

ServeMethod · 0.95
pullMethod · 0.95
scanSubdirsMethod · 0.95

Calls 7

SchedulePullMethod · 0.95
stopWatchMethod · 0.95
scheduleWatchRestartMethod · 0.95
ErrorFunction · 0.92
DoneMethod · 0.80
getStateMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected