Made the fetcher a Fetcher type with per-source config, and ran it in job-search serve

fetcher.Run(ctx, conf, since) becomes New(&conf.Sources, opts...) and
Run(ctx, since). Each worker now takes only its own source's config, and
Run starts each one through a closure that binds it. Cancelling ctx stops
the workers through the Fetcher's background context, and Run always waits
for every worker before returning their joined errors.

The findatender client no longer holds the configuration: New takes only
the API root, ReloadConfig is gone, and request tracing follows
logging.IsDebugEnabled(). The FindAOpportunity worker is now FindATender.

job-search serve runs the fetcher alongside the HTTP server. A source that
fails stops the server, and the server stopping stops the sources; with no
sources enabled the server keeps running. fetcher service and fetcher
fts-once use the new APIs.
This commit is contained in:
bwilliams committed 2026-10-16 10:44:38 +01:00
1 parent f0c171c8a8
commit 18db462d89
12 files changed
+269 -214

No files matched your search

+3 -3
View File
@@ -307,10 +307,10 @@ func closeBody(res *resty.Response) {
}
// fetchURI performs a single GET of uri, using findATender's context, and
// traces it at debug level. Unlike the method of the same name it does not
// check the response status.
// traces it when debug logging is on (logging.IsDebugEnabled). Unlike the
// method of the same name it does not check the response status.
func fetchURI(findATender *FindATender, uri string) (*resty.Response, error) {
withTrace := findATender.config.Logging.LogLevel() <= slog.LevelDebug
withTrace := logging.IsDebugEnabled()
logger := findATender.logger()
logger.Info("fetching", "uri", uri)