milergeo added
This commit is contained in:
@@ -9,6 +9,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"doormile/internal/milergeo"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -159,13 +161,7 @@ func nearbyMilers(rdb *redis.Client) Executor {
|
||||
if in.RadiusKm <= 0 || in.RadiusKm > nearbyMaxKm {
|
||||
in.RadiusKm = 5
|
||||
}
|
||||
locs, err := rdb.GeoSearchLocation(ctx, "milers:locations", &redis.GeoSearchLocationQuery{
|
||||
GeoSearchQuery: redis.GeoSearchQuery{
|
||||
Longitude: *in.Lon, Latitude: *in.Lat,
|
||||
Radius: in.RadiusKm, RadiusUnit: "km", Sort: "ASC", Count: nearbyMaxCount,
|
||||
},
|
||||
WithDist: true,
|
||||
}).Result()
|
||||
locs, err := milergeo.Search(ctx, rdb, *in.Lat, *in.Lon, in.RadiusKm, nearbyMaxCount)
|
||||
if err != nil {
|
||||
return nil, errors.New("live rider positions are unavailable")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user