(ctx context.Context, err error)
| 1175 | } |
| 1176 | |
| 1177 | func (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 | |
| 1211 | func (f *folder) pullBasePause() time.Duration { |
| 1212 | if f.PullerPauseS == 0 { |
no test coverage detected