mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-06 03:16:46 +00:00
new(userspace/falco): handle subscribe events as streams based on keepalive
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com> Signed-off-by: Lorenzo Fontana <lo@linux.com>
This commit is contained in:
parent
fcc7fad0e7
commit
5abb26e764
@ -117,14 +117,16 @@ void falco_grpc_server_impl::subscribe(const stream_context& ctx, const falco_ou
|
|||||||
{
|
{
|
||||||
// Start (or continue) streaming
|
// Start (or continue) streaming
|
||||||
// ctx.m_status == stream_context::STREAMING
|
// ctx.m_status == stream_context::STREAMING
|
||||||
// todo > do we want batching?
|
if(m_event_queue.try_pop(res) && !req.keepalive())
|
||||||
dequeue:
|
|
||||||
if(!m_event_queue.try_pop(res))
|
|
||||||
{
|
{
|
||||||
// TODO: backoff mechanism that does has more false
|
ctx.m_has_more = true;
|
||||||
goto dequeue;
|
return;
|
||||||
}
|
}
|
||||||
ctx.m_has_more = true;
|
while(!m_event_queue.try_pop(res) && req.keepalive())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.m_has_more = req.keepalive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user