From bded6cbea0051f7ac9e64d47e2ebdef1d641c241 Mon Sep 17 00:00:00 2001 From: Abdulazez Zeinu Ali Date: Mon, 11 May 2026 23:41:54 +0300 Subject: [PATCH] gmaps,postgres: fix typo in field name and use idiomatic time.Since - Rename UsageInResultststs -> UsageInResults in PlaceJob struct (obvious keyboard fumble with extra 'tsts'; the method was already correctly named UseInResults) - Replace time.Now().UTC().Sub(lastSave) with time.Since(lastSave) in resultWriter.Run for consistency with Go idioms --- gmaps/place.go | 8 ++++---- postgres/resultwriter.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gmaps/place.go b/gmaps/place.go index fd1a8690..b7eca862 100644 --- a/gmaps/place.go +++ b/gmaps/place.go @@ -17,7 +17,7 @@ type PlaceJobOptions func(*PlaceJob) type PlaceJob struct { scrapemate.Job - UsageInResultststs bool + UsageInResults bool ExtractEmail bool ExitMonitor exiter.Exiter ExtractExtraReviews bool @@ -42,7 +42,7 @@ func NewPlaceJob(parentID, langCode, u string, extractEmail, extraExtraReviews b }, } - job.UsageInResultststs = true + job.UsageInResults = true job.ExtractEmail = extractEmail job.ExtractExtraReviews = extraExtraReviews @@ -133,7 +133,7 @@ func (j *PlaceJob) Process(_ context.Context, resp *scrapemate.Response) (any, [ emailJob := NewEmailJob(j.ID, &entry, opts...) - j.UsageInResultststs = false + j.UsageInResults = false return nil, []scrapemate.IJob{emailJob}, nil } else if j.ExitMonitor != nil && !j.WriterManagedCompletion { @@ -291,7 +291,7 @@ func (j *PlaceJob) getReviewCount(data []byte) int { } func (j *PlaceJob) UseInResults() bool { - return j.UsageInResultststs + return j.UsageInResults } const js = ` diff --git a/postgres/resultwriter.go b/postgres/resultwriter.go index 8658ac27..18d1bff1 100644 --- a/postgres/resultwriter.go +++ b/postgres/resultwriter.go @@ -40,7 +40,7 @@ func (r *resultWriter) Run(ctx context.Context, in <-chan scrapemate.Result) err buff = append(buff, entry) - if len(buff) >= maxBatchSize || time.Now().UTC().Sub(lastSave) >= time.Minute { + if len(buff) >= maxBatchSize || time.Since(lastSave) >= time.Minute { err := r.batchSave(ctx, buff) if err != nil { return err