Minor fixes:

- Fixed function name typo
- Fetcher/Run now returns a combination of errors if any workers error out. All other workers are ordered to shutdown if any one does error out
- findATender now returns a pointer instead of an instance from New
This commit is contained in:
bwilliams committed 2026-10-09 18:26:10 +01:00
1 parent 5cb3601e1f
commit 005b335371
6 files changed
+31 -15

No files matched your search

+6 -5
View File
@@ -119,6 +119,8 @@ func recursiveRepairDates(v any) bool {
return changed
}
// isDateField reports whether a field holds a date, by its name (see
// repairDates).
func isDateField(name string) bool {
return strings.HasPrefix(name, "date") ||
strings.Contains(name, "Date") ||
@@ -322,10 +324,9 @@ func (ft *FindATender) fetchURI(
return nil, err
}
if ft.ctx == nil {
copied := *ft
copied.ctx = context.Background()
ft = &copied
ctx := ft.ctx
if ctx == nil {
ctx = context.Background()
}
if res.StatusCode() == 429 {
@@ -344,7 +345,7 @@ func (ft *FindATender) fetchURI(
slog.Warn(fmt.Sprintf(
"API rate limit hit, waiting as requested for %d seconds", retrySec,
))
if rateSleep(ft.ctx, time.Duration(retrySec)*time.Second) != nil {
if rateSleep(ctx, time.Duration(retrySec)*time.Second) != nil {
return nil, ErrFetchCancelled
}
+2 -2
View File
@@ -16,8 +16,8 @@ type FindATender struct {
ctx context.Context
}
func New(conf *config.JobSearchConfig, apiRoot string) FindATender {
ft := FindATender{
func New(conf *config.JobSearchConfig, apiRoot string) *FindATender {
ft := &FindATender{
config: conf,
apiRoot: apiRoot,
}