module Lita::External

Constants

VERSION

Public Instance Methods

blocking_redis() click to toggle source

It's important to use another redis connection than Lita's one, because we are using long blocking calls and redis use a mutex around these

# File lib/lita/external.rb, line 14
def blocking_redis
  @blocking_redis ||= Redis::Namespace.new(Lita::REDIS_NAMESPACE, redis: Redis.new(Lita.config.redis))
end
dump_message(message) click to toggle source
# File lib/lita/external.rb, line 18
def dump_message(message)
  # The robot instance contains Proc and other non serializable attributes
  # Also, it's a singleton and should be set again in the receiving process anyway
  message.instance_variable_set(:@robot, nil)
  Marshal.dump(message)
end
load_message(payload, robot: ) click to toggle source
# File lib/lita/external.rb, line 25
def load_message(payload, robot: )
  message = Marshal.load(payload)
  message.instance_variable_set(:@robot, robot)
  message
end