milergeo added
This commit is contained in:
13
main.go
13
main.go
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user