This commit is contained in:
bel
2026-03-08 22:24:36 -06:00
parent ffdb643bef
commit 4c5d4e805c

View File

@@ -27,7 +27,7 @@ func NewMapsOf(ctx context.Context, town string) (*Maps, error) {
} }
var rps = 2 var rps = 2
var limit = 200 var mapsLimit = 200
var mapsLimiter = rate.NewLimiter(rate.Limit(rps), 1) var mapsLimiter = rate.NewLimiter(rate.Limit(rps), 1)
type Location struct { type Location struct {
@@ -60,7 +60,7 @@ func (m *Maps) Search(ctx context.Context, query string) ([]Location, error) {
locations := []Location{} locations := []Location{}
nextToken := "" nextToken := ""
for { for len(locations) < mapsLimit {
results, err := m._textSearch(ctx, query, nextToken) results, err := m._textSearch(ctx, query, nextToken)
if err != nil { if err != nil {
return nil, err return nil, err