Pass context to event publishing.
To allow tracing propagation via events, we need to pass the context to the `Publish` function of reva events. This adds the context everywhere where events are published. If there was no context to pass, we started a new one with `context.Background()`.
This commit is contained in:
@@ -95,7 +95,7 @@ func (g Graph) PostGroup(w http.ResponseWriter, r *http.Request) {
|
||||
if currentUser, ok := revactx.ContextGetUser(r.Context()); ok {
|
||||
e.Executant = currentUser.GetId()
|
||||
}
|
||||
g.publishEvent(e)
|
||||
g.publishEvent(r.Context(), e)
|
||||
}
|
||||
render.Status(r, http.StatusOK) // FIXME 201 should return 201 created
|
||||
render.JSON(w, r, grp)
|
||||
@@ -256,7 +256,7 @@ func (g Graph) DeleteGroup(w http.ResponseWriter, r *http.Request) {
|
||||
if currentUser, ok := revactx.ContextGetUser(r.Context()); ok {
|
||||
e.Executant = currentUser.GetId()
|
||||
}
|
||||
g.publishEvent(e)
|
||||
g.publishEvent(r.Context(), e)
|
||||
render.Status(r, http.StatusNoContent)
|
||||
render.NoContent(w, r)
|
||||
}
|
||||
@@ -366,7 +366,7 @@ func (g Graph) PostGroupMember(w http.ResponseWriter, r *http.Request) {
|
||||
if currentUser, ok := revactx.ContextGetUser(r.Context()); ok {
|
||||
e.Executant = currentUser.GetId()
|
||||
}
|
||||
g.publishEvent(e)
|
||||
g.publishEvent(r.Context(), e)
|
||||
render.Status(r, http.StatusNoContent)
|
||||
render.NoContent(w, r)
|
||||
}
|
||||
@@ -418,7 +418,7 @@ func (g Graph) DeleteGroupMember(w http.ResponseWriter, r *http.Request) {
|
||||
if currentUser, ok := revactx.ContextGetUser(r.Context()); ok {
|
||||
e.Executant = currentUser.GetId()
|
||||
}
|
||||
g.publishEvent(e)
|
||||
g.publishEvent(r.Context(), e)
|
||||
render.Status(r, http.StatusNoContent)
|
||||
render.NoContent(w, r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user