By default, the ListenerThreadMonitor will consolidate streaming connections whenever there are enough non-maxed out connections to do so. Ideally, this process would work as follows:
This is how it works right now:
30 seconds may be too short or too long.
httplib’s response object doesn’t have a method for returning all data that’s been downloaded ‘so far’. You can either wait for the download to complete (which never happens because it’s a stream), or consume the data X characters at a time.
The response object blocks if it hasn’t yet received X characters. Because of this, Sitebucket has to consume the data returned by the stream 1 character at a time.
This causes really high CPU spikes when the stream is consuming large amounts of data. Unfortunately, this occurs regularly upon connection initialization because twitter sends a list of each user’s followings.
The Default parser should recognize and call functions for all types of messages returned by the streaming API.