Increase replicas to 2 in Kubernetes deployment and switch game.start and game.input handlers from NATS Queue Groups to broadcast mode.
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m29s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m29s
This commit is contained in:
@@ -141,8 +141,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
log.Printf("👂 Lausche auf 'game.join' in Queue Group 'game-servers'... (Sub Valid: %v)", sub.IsValid())
|
log.Printf("👂 Lausche auf 'game.join' in Queue Group 'game-servers'... (Sub Valid: %v)", sub.IsValid())
|
||||||
|
|
||||||
// 4. HANDLER: GAME START (mit Queue Group)
|
// 4. HANDLER: GAME START (broadcast - alle Pods empfangen, nur der mit dem Raum reagiert)
|
||||||
_, _ = ec.QueueSubscribe("game.start", "game-servers", func(req *game.StartRequest) {
|
_, _ = ec.Subscribe("game.start", func(req *game.StartRequest) {
|
||||||
log.Printf("▶️ START empfangen: RoomID=%s", req.RoomID)
|
log.Printf("▶️ START empfangen: RoomID=%s", req.RoomID)
|
||||||
|
|
||||||
mu.RLock()
|
mu.RLock()
|
||||||
@@ -159,8 +159,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 5. HANDLER: INPUT (mit Queue Group)
|
// 5. HANDLER: INPUT (broadcast - alle Pods empfangen, nur der mit dem Spieler reagiert)
|
||||||
_, _ = ec.QueueSubscribe("game.input", "game-servers", func(input *game.ClientInput) {
|
_, _ = ec.Subscribe("game.input", func(input *game.ClientInput) {
|
||||||
mu.RLock()
|
mu.RLock()
|
||||||
room, ok := playerSessions[input.PlayerID]
|
room, ok := playerSessions[input.PlayerID]
|
||||||
mu.RUnlock()
|
mu.RUnlock()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
app: escape-game
|
app: escape-game
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 2
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: escape-game
|
app: escape-game
|
||||||
|
|||||||
Reference in New Issue
Block a user