Sha256: 5cb5c41957fd8e39ba6b071d44c805b296d3a2530c32b2bdf21b3205052a8906
Contents?: true
Size: 587 Bytes
Versions: 1
Compression:
Stored size: 587 Bytes
Contents
module GemeraldBeanstalk::EventServer def beanstalk return @beanstalk end def initialize(beanstalk) @beanstalk = beanstalk @partial_message = '' super end def post_init @connection = beanstalk.connect(self) end def receive_data(data) if data[-2, 2] == "\r\n" message = @partial_message + data @partial_message = '' EventMachine.defer(proc { @connection.execute(message) }) else @partial_message += data end end def unbind beanstalk.disconnect(@connection) @connection.close_connection end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gemerald_beanstalk-0.1.0 | lib/gemerald_beanstalk/event_server.rb |