milergeo added

This commit is contained in:
2026-10-06 12:26:57 +05:30
parent 220e934045
commit 9b94be1f07
10 changed files with 329 additions and 44 deletions

13
main.go
View File

@@ -1,6 +1,7 @@
package main
import (
"context"
"errors"
"net/url"
"os"
@@ -15,6 +16,7 @@ import (
"doormile/internal/ai/playground"
"doormile/internal/ai/telemetry"
"doormile/internal/assignment"
"doormile/internal/milergeo"
"doormile/internal/notify"
"doormile/internal/routing"
"doormile/internal/sms"
@@ -100,6 +102,17 @@ func main() {
// 2. Connect to Postgres, Redis & NATS
db.Connect(cfg)
db.InitRedis(cfg)
// Auto-assignment finds riders with a Redis GEO search. When that search
// fails every order silently finds "no riders", so say so at boot.
if db.Rdb != nil {
geoCtx, geoCancel := context.WithTimeout(context.Background(), 3*time.Second)
if geo := milergeo.Probe(geoCtx, db.Rdb); strings.HasPrefix(geo, "error") {
utils.Error("❌ Rider location search is broken: auto-assignment will find no riders", "redis_geo", geo)
} else {
utils.Info("✅ Rider location search ready", "redis_geo", geo)
}
geoCancel()
}
db.InitNATS(cfg)
notify.InitFCM()