mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
fix: preserve assignment event revisions
This commit is contained in:
@@ -58,6 +58,10 @@ type AssignmentView struct {
|
||||
ProtocolVersion int `json:"protocol_version"`
|
||||
Transport string `json:"transport"`
|
||||
JoinAuthorisation string `json:"join_authorisation"`
|
||||
// Revision is routing metadata for the event stream, not part of the v1
|
||||
// assignment response. Keeping it alongside the durable view prevents the
|
||||
// REST recovery boundary from emitting a synthetic revision zero.
|
||||
Revision uint64 `json:"-"`
|
||||
}
|
||||
|
||||
type AssignmentProvider func(context.Context, string, string, time.Time) (AssignmentView, error)
|
||||
@@ -509,10 +513,14 @@ func (s *Service) assignment(w http.ResponseWriter, r *http.Request) {
|
||||
writeError(w, http.StatusServiceUnavailable, "assignment_unavailable")
|
||||
return
|
||||
}
|
||||
_ = s.PublishControlPlaneEvent(ControlPlaneEvent{Event: "assignment_changed", Revision: 0, ResourceID: view.MatchID, OccurredAt: now, MatchID: view.MatchID, ServerID: view.ServerID, PlayerID: view.PlayerID})
|
||||
_ = s.PublishControlPlaneEvent(assignmentChangedEvent(view, now))
|
||||
writeJSON(w, http.StatusOK, view)
|
||||
}
|
||||
|
||||
func assignmentChangedEvent(view AssignmentView, now time.Time) ControlPlaneEvent {
|
||||
return ControlPlaneEvent{Event: "assignment_changed", Revision: view.Revision, ResourceID: view.MatchID, OccurredAt: now, MatchID: view.MatchID, ServerID: view.ServerID, PlayerID: view.PlayerID}
|
||||
}
|
||||
|
||||
type rankedProfileResponse struct {
|
||||
Rating float64 `json:"rating"`
|
||||
RD float64 `json:"rd"`
|
||||
|
||||
Reference in New Issue
Block a user