perf(go): cache realtime plate lookups

This commit is contained in:
lingniu
2026-07-03 07:42:24 +08:00
parent 9345fe60b5
commit 1c0d7dc03e
5 changed files with 124 additions and 2 deletions

View File

@@ -114,6 +114,18 @@ func TestRealtimeAPIDoesNotExposeDuplicateMileagePointRoute(t *testing.T) {
}
}
func TestRealtimeAPICachesBindingPlateResolver(t *testing.T) {
source, err := os.ReadFile("main.go")
if err != nil {
t.Fatalf("read main.go: %v", err)
}
for _, want := range []string{"NewCachedPlateResolver", "PLATE_CACHE_TTL_SECONDS"} {
if !strings.Contains(string(source), want) {
t.Fatalf("realtime api should configure cached plate resolver, missing %s", want)
}
}
}
type contextCheckingRealtimeUpdater struct {
ctxErr error
count int