-
Notifications
You must be signed in to change notification settings - Fork 352
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
feature: filter fifoWithBody #2676
Conversation
@AlexanderYastrebov maybe better than #2675 wdyt? |
case fifoWithBody: | ||
ctx.StateBag()[filters.FifoWithBody] = g |
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.
Its not clear how multiple fifoWithBody would chain and how they would interplay with regular fifo.
I think you'd need to have the same logic stored under different keys and then run chain of hooks in two places in proxy depending on the key at proxy.do and proxy.ServeHTTP:
...
func (f *fifoFilter) createResponse(ctx filters.FilterContext, typ string) {
pending, ok := ctx.StateBag()[typ].([]func())
if !ok {
return
}
last := len(pending) - 1
if last < 0 {
return
}
pending[last]()
ctx.StateBag()[fifoKey] = pending[:last]
}
...
// existing in proxy.do
pendingFIFO, _ := stateBag[scheduler.FIFOKey].([]func())
for _, done := range pendingFIFO {
done()
}
...
// in proxy.ServeHTTP
pendingFIFO, _ := stateBag[scheduler.FIFOWithBodyKey].([]func())
for _, done := range pendingFIFO {
done()
}
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.
Yes that's a good point. I also thought about that I need to do something like that.
What do you like more to support the copystream part? this one or the other?
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.
I think we can remove existing pendingFIFO cleanup from proxy.go see #2680
const ( | ||
fifo fifoType = iota + 1 | ||
fifoWithBody | ||
) |
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.
You can use filter name as spec.typ and have withBody bool in filter similar to
skipper/filters/diag/histogram.go
Lines 56 to 57 in 2a202c4
f := &histFilter{ | |
response: s.typ == filters.HistogramResponseLatencyName, |
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.
I like the enum style better than string.
Make lifo, lifoGroup and fifo filters backed error aware and remove cleanup from the proxy. Follow up on #1054, #1086 and #2239 Updates #1238 Signed-off-by: Alexander Yastrebov <[email protected]>
…e defered until body streaming to client was finished Signed-off-by: Sandor Szücs <[email protected]>
451e0df
to
1eb2e0f
Compare
close to create a PR to cw2023freeze |
feature: filter fifoWithBody that works similar to fifo(), but release deferred until body streaming to client was finished