updates on the ai agents and time series prediction and updates on the api to
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
|
||||
@@ -31,6 +32,35 @@ type Client interface {
|
||||
GeoAdd(ctx context.Context, key string, geoLocation ...*redis.GeoLocation) *redis.IntCmd
|
||||
GeoSearchLocation(ctx context.Context, key string, q *redis.GeoSearchLocationQuery) *redis.GeoSearchLocationCmd
|
||||
GeoRadius(ctx context.Context, key string, longitude, latitude float64, query *redis.GeoRadiusQuery) *redis.GeoLocationCmd
|
||||
ZRem(ctx context.Context, key string, members ...interface{}) *redis.IntCmd
|
||||
}
|
||||
|
||||
// Remove drops a rider from the GEO set.
|
||||
//
|
||||
// ─── Why this has to exist ─────────────────────────────────────────────────
|
||||
//
|
||||
// A GEO set member never expires. Nothing removed a rider when they went off
|
||||
// duty, so `milers:locations` accumulated every rider who had ever started a
|
||||
// shift, frozen at their last reported position — for good.
|
||||
//
|
||||
// That is not merely untidy, because assignment asks for the TEN NEAREST
|
||||
// members (geoMaxCount in internal/assignment). Riders who finished weeks ago,
|
||||
// parked near the hub where most pickups originate, are geographically the
|
||||
// closest members there are. They fill all ten slots, every one of them is
|
||||
// then discarded by the GPS-freshness check, and the candidate pool collapses
|
||||
// to whoever happened to survive — often a single rider.
|
||||
//
|
||||
// The balancing logic below that (leastLoaded, betterChoice) is correct and
|
||||
// irrelevant: it can only balance across the pool it is handed. The symptom is
|
||||
// every order in a city going to the same person.
|
||||
//
|
||||
// Called on end-duty. A failure is logged by the caller and not fatal: a rider
|
||||
// left in the set is the status quo, not a regression.
|
||||
func Remove(ctx context.Context, rdb Client, milerUserID int) error {
|
||||
if rdb == nil {
|
||||
return nil
|
||||
}
|
||||
return rdb.ZRem(ctx, Key, strconv.Itoa(milerUserID)).Err()
|
||||
}
|
||||
|
||||
// legacyOnly flips to true the first time the server rejects GEOSEARCH as an
|
||||
|
||||
Reference in New Issue
Block a user