-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
events: Ignore send context #23500
events: Ignore send context #23500
Conversation
When sending an event asynchornously, the original context used for whatever generated the event (probably a synchronous, quick HTTP context) is probably not what is wanted for sending the event, which could face delays if a consumer is backed up. I will admit myself to sometimes having "context blindness", where I just take whatever context is incoming in a function and thread it out to all calls. Normally this is the right thing to do when, say, tying downstream API calls to an upstream HTTP timeout. When making KV events, for example, we used the HTTP context for `SendEvent()`, and this can cause the events to be dropped if they aren't taken from the channel before the HTTP request finishes. In retrospect, it was probably unnecessary to include a context in the `SendEvent` interface. We keep the context in place for backwards compability, but also in case we want to use it for purposes other than timeouts and cancellations in the future.
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Build Results: |
CI Results: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor suggestion to consider, then 👍
vault/eventbus/bus.go
Outdated
@@ -114,7 +114,8 @@ func patchMountPath(data *logical.EventData, pluginInfo *logical.EventPluginInfo | |||
// This function is meant to be used by trusted internal code, so it can specify details like the namespace | |||
// and plugin info. Events from plugins should be routed through WithPlugin(), which will populate | |||
// the namespace and plugin info automatically. | |||
func (bus *EventBus) SendEventInternal(ctx context.Context, ns *namespace.Namespace, pluginInfo *logical.EventPluginInfo, eventType logical.EventType, data *logical.EventData) error { | |||
// The context passed in is currently ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: although the reason for ignoring the context is well documented in the PR, you may want to include a brief summary here as well.
Thanks! |
When sending an event asynchronously, the original context used for whatever generated the event (probably a synchronous, quick HTTP context) is probably not what is wanted for sending the event, which could face delays if a consumer is backed up. I will admit myself to sometimes having "context blindness", where I just take whatever context is incoming in a function and thread it out to all calls. Normally this is the right thing to do when, say, tying downstream API calls to an upstream HTTP timeout. When making KV events, for example, we used the HTTP context for `SendEvent()`, and this can cause the events to be dropped if they aren't taken from the channel before the HTTP request finishes. In retrospect, it was probably unnecessary to include a context in the `SendEvent` interface. We keep the context in place for backwards compability, but also in case we want to use it for purposes other than timeouts and cancellations in the future.
When sending an event asynchronously, the original context used for whatever generated the event (probably a synchronous, quick HTTP context) is probably not what is wanted for sending the event, which could face delays if a consumer is backed up. I will admit myself to sometimes having "context blindness", where I just take whatever context is incoming in a function and thread it out to all calls. Normally this is the right thing to do when, say, tying downstream API calls to an upstream HTTP timeout. When making KV events, for example, we used the HTTP context for `SendEvent()`, and this can cause the events to be dropped if they aren't taken from the channel before the HTTP request finishes. In retrospect, it was probably unnecessary to include a context in the `SendEvent` interface. We keep the context in place for backwards compability, but also in case we want to use it for purposes other than timeouts and cancellations in the future.
When sending an event asynchronously, the original context used for whatever generated the event (probably a synchronous, quick HTTP context) is probably not what is wanted for sending the event, which could face delays if a consumer is backed up. I will admit myself to sometimes having "context blindness", where I just take whatever context is incoming in a function and thread it out to all calls. Normally this is the right thing to do when, say, tying downstream API calls to an upstream HTTP timeout. When making KV events, for example, we used the HTTP context for `SendEvent()`, and this can cause the events to be dropped if they aren't taken from the channel before the HTTP request finishes. In retrospect, it was probably unnecessary to include a context in the `SendEvent` interface. We keep the context in place for backwards compability, but also in case we want to use it for purposes other than timeouts and cancellations in the future. Co-authored-by: Christopher Swenson <christopher.swenson@hashicorp.com>
When sending an event asynchronously, the original context used for whatever generated the event (probably a synchronous, quick HTTP context) is probably not what is wanted for sending the event, which could face delays if a consumer is backed up. I will admit myself to sometimes having "context blindness", where I just take whatever context is incoming in a function and thread it out to all calls. Normally this is the right thing to do when, say, tying downstream API calls to an upstream HTTP timeout. When making KV events, for example, we used the HTTP context for `SendEvent()`, and this can cause the events to be dropped if they aren't taken from the channel before the HTTP request finishes. In retrospect, it was probably unnecessary to include a context in the `SendEvent` interface. We keep the context in place for backwards compability, but also in case we want to use it for purposes other than timeouts and cancellations in the future. Co-authored-by: Christopher Swenson <christopher.swenson@hashicorp.com>
When sending an event asynchornously, the original context used for whatever generated the event (probably a synchronous, quick HTTP context) is probably not what is wanted for sending the event, which could face delays if a consumer is backed up.
I will admit myself to sometimes having "context blindness", where I just take whatever context is incoming in a function and thread it out to all calls. Normally this is the right thing to do when, say, tying downstream API calls to an upstream HTTP timeout.
When making KV events, for example, we used the HTTP context for
SendEvent()
, and this can cause the events to be dropped if they aren't taken from the channel before the HTTP request finishes.In retrospect, it was probably unnecessary to include a context in the
SendEvent
interface.We keep the context in place for backwards compability, but also in case we want to use it for purposes other than timeouts and cancellations in the future.