-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fix: fix memory leak in endpoint buffer #808
Conversation
@@ -30,7 +32,7 @@ func (t *EndpointTask) Execute(ctx context.Context, options ...interface{}) erro | |||
return err | |||
} | |||
|
|||
return instance.buffer.ForwardRequest(echoCtx, t) | |||
return instance.buffer.ForwardRequest(echoCtx, t, payload) |
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.
This is a little hacky, but it makes sure that endpoint request payloads don't get stored in redis along with the rest of the task message. Since endpoint tasks don't support retries, this isn't necessary and wastes redis memory.
@@ -176,6 +173,11 @@ func (rb *RequestBuffer) processRequests() { | |||
continue | |||
} | |||
|
|||
if req.ctx.Request().Context().Err() != nil { |
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.
If the client hung up by the time we're handling this request (error is not nil even if the context is just cancelled), then we should just mark this task as canceled and move on to the next item in the request buffer.
NOTE: Still need to reproduce this locally before merging