move more code

This commit is contained in:
matst80
2025-12-02 23:23:59 +01:00
parent 5f6a7c47c9
commit a0142c2698
12 changed files with 708 additions and 696 deletions

View File

@@ -107,21 +107,13 @@ func main() {
cartClient := NewCartClient(cartInternalUrl)
syncedServer := NewCheckoutPoolServer(pool, fmt.Sprintf("%s, %s", name, podIp), klarnaClient, cartClient, adyenClient)
app := &App{
pool: pool,
server: syncedServer,
klarnaClient: klarnaClient,
cartClient: cartClient,
}
syncedServer.inventoryService = inventoryService
mux := http.NewServeMux()
debugMux := http.NewServeMux()
if amqpUrl == "" {
log.Printf("no connection to amqp defined")
} else {
app.HandleCheckoutRequests(amqpUrl, mux, inventoryService)
log.Fatalf("no connection to amqp defined")
}
grpcSrv, err := actor.NewControlServer[*checkout.CheckoutGrain](controlPlaneConfig, pool)
@@ -143,7 +135,7 @@ func main() {
syncedServer.Serve(mux)
mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
grainCount, capacity := app.pool.LocalUsage()
grainCount, capacity := pool.LocalUsage()
if grainCount >= capacity {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte("grain pool at capacity"))