Skip to content

Commit 8c40e1c

Browse files
authored
Publish observations if request init fails (#438)
## Summary Publish observations if request init fails
1 parent c1ebc6d commit 8c40e1c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

gateway/gateway.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,6 @@ func (g Gateway) handleHTTPServiceRequest(
105105
dataReporter: g.DataReporter,
106106
}
107107

108-
// Initialize the GatewayRequestContext struct using the HTTP request.
109-
// e.g. extract the target service ID from the HTTP request.
110-
err := gatewayRequestCtx.InitFromHTTPRequest(httpReq)
111-
if err != nil {
112-
return
113-
}
114-
115108
defer func() {
116109
// Write the user-facing HTTP response.
117110
gatewayRequestCtx.WriteHTTPUserResponse(responseWriter)
@@ -120,6 +113,13 @@ func (g Gateway) handleHTTPServiceRequest(
120113
gatewayRequestCtx.BroadcastAllObservations()
121114
}()
122115

116+
// Initialize the GatewayRequestContext struct using the HTTP request.
117+
// e.g. extract the target service ID from the HTTP request.
118+
err := gatewayRequestCtx.InitFromHTTPRequest(httpReq)
119+
if err != nil {
120+
return
121+
}
122+
123123
// TODO_CHECK_IF_DONE(@adshmh): Pass the context with deadline to QoS once it can handle deadlines.
124124
// Build the QoS context for the target service ID using the HTTP request's payload.
125125
err = gatewayRequestCtx.BuildQoSContextFromHTTP(httpReq)

0 commit comments

Comments
 (0)