Wind down the SSE thread when the client disconnects (#1514)
These started to appear when I `^C` `curl -N http://localhost:5052/beacon/fork/stream`: `Aug 12 13:00:01.539 ERRO Couldn't stream piece hyper::Error(ChannelClosed), service: http` Something must have changed in hyper since SSE has been implemented because I'm sure I haven't seen those errors before. This PR properly detects a closed SSE stream and cleans up.
This commit is contained in:
parent
e6f45524f9
commit
05a8399769
@ -155,8 +155,10 @@ pub fn stream_forks<T: BeaconChainTypes>(
|
||||
break;
|
||||
}
|
||||
};
|
||||
if let Err(bytes) = block_on(sender.send_data(chunk)) {
|
||||
error!(log, "Couldn't stream piece {:?}", bytes);
|
||||
match block_on(sender.send_data(chunk)) {
|
||||
Err(e) if e.is_closed() => break,
|
||||
Err(e) => error!(log, "Couldn't stream piece {:?}", e),
|
||||
Ok(_) => (),
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user