wmoxam (owner)

Revisions

gist: 128162 Download_button fork
public
Public Clone URL: git://gist.github.com/128162.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module AsyncObserver::Extensions
  def async_execute(selector, *args)
    if RAILS_ENV == 'test' # this is due to async_obeserver's poor test integration :(
      self.send selector, *args
    else
      begin
        self.async_send selector, *args
      rescue Beanstalk::UnexpectedResponse, Beanstalk::NotConnected
        # Beanstalk is having an issue, run the command directly
        self.send selector, *args
      end
    end
  end
end