mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
parent
1e7e9319c3
commit
dab620b01e
@ -131,10 +131,17 @@ kj::Promise<void> Http::cleanupPeers(kj::Timer& timer)
|
|||||||
{
|
{
|
||||||
return timer.afterDelay(15 * kj::SECONDS).then([&]{
|
return timer.afterDelay(15 * kj::SECONDS).then([&]{
|
||||||
for(EventPeer* p : eventPeers) {
|
for(EventPeer* p : eventPeers) {
|
||||||
|
// Even single threaded, if load causes this timeout to be serviced
|
||||||
|
// before writeEvents has created a fulfiller, or if an exception
|
||||||
|
// caused the destruction of the promise but attach(peer) hasn't yet
|
||||||
|
// removed it from the eventPeers list, we will see a null fulfiller
|
||||||
|
// here
|
||||||
|
if(p->fulfiller) {
|
||||||
// an empty SSE message is a colon followed by two newlines
|
// an empty SSE message is a colon followed by two newlines
|
||||||
p->pendingOutput.push_back(":\n\n");
|
p->pendingOutput.push_back(":\n\n");
|
||||||
p->fulfiller->fulfill();
|
p->fulfiller->fulfill();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return cleanupPeers(timer);
|
return cleanupPeers(timer);
|
||||||
}).eagerlyEvaluate(nullptr);
|
}).eagerlyEvaluate(nullptr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user