pubnub/ruby — pull request #4 by dalyons (2013-06-23 15:30:51+00:00)
Title: Stop pubnub from crashing EventMachine through unsafe use of threads.

__Problem__: Under moderate load(~50 publishes in one go) pubnub caused EventMachine to crash and drop all the following publishes on the floor.
__Reason__: EM is not threadsafe, by design. Everything is supposed to be done on the single reactor thread, using EM.defer/EM.schedule if necessary. Worker threads & the reactor pattern are sort of two opposing paradigms and shouldn't be mixed.
__Solution__: dont use threads inside a reactor.