isnotajoke/vSPC.py — comment on commit a19804ada5b57178276517eb9af0003384bf884f
File: vSPC.py line 535
By isnotajoke:

Before this change, readers and writers were only added to the selector by the same thread of control that eventually called run_once (i.e., in response to a read, write, connection, etc), and all such modifications finished before run_once was called again. With a worker thread in vSPC, that's no longer the case; readers and writers are added when the worker thread processes new connections, reads, and writes, which will not necessarily correspond in any predictable way to when run_once is called. The effect of this is that new connections could idle sit unwatched for a while in the Sslector until an event on a stream the selector was already watching broke out of the run_once loop. Adding a timeout of 1.5 seconds provides an upper bound on the time before a newly-added stream is watched for events. That's kind of ugly, and there are other problems with this approach. In a later commit, I make a Poller, which uses epoll to avoid this issue.