tried to git rid of error in em-http-request
This commit is contained in:
parent
43207aeb41
commit
67535c1113
4 changed files with 59 additions and 71 deletions
2
Gemfile
2
Gemfile
|
|
@ -3,7 +3,7 @@ source 'http://rubygems.org'
|
|||
gem 'rails', '3.0.0.beta4'
|
||||
gem 'mongrel'
|
||||
gem 'thin'
|
||||
gem 'em-http-request'
|
||||
gem 'em-http-request', :git => 'git@github.com:maxwell/em-http-request.git'
|
||||
gem 'addressable'
|
||||
gem "mongoid", :git => "http://github.com/durran/mongoid.git"
|
||||
gem "bson_ext", "1.0.1"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
class Post
|
||||
require 'lib/common'
|
||||
require 'lib/message_handler'
|
||||
|
||||
|
||||
# XML accessors must always preceed mongo field tags
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include ROXML
|
||||
|
||||
@@queue = MessageHandler.new
|
||||
include Diaspora::Hookey
|
||||
|
||||
xml_accessor :owner
|
||||
|
|
@ -21,7 +23,6 @@ class Post
|
|||
#after_update :notify_friends
|
||||
|
||||
|
||||
|
||||
@@models = ["StatusMessage", "Bookmark", "Blog"]
|
||||
|
||||
def self.recent_ordered_posts
|
||||
|
|
|
|||
|
|
@ -19,30 +19,19 @@ module Diaspora
|
|||
|
||||
module Hookey
|
||||
|
||||
class Curl
|
||||
def self.post(s)
|
||||
`curl -X POST -d #{s}`;;
|
||||
end
|
||||
|
||||
def self.get(s)
|
||||
`curl -X GET #{s}`
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.included(klass)
|
||||
|
||||
klass.class_eval do
|
||||
require 'lib/message_handler'
|
||||
#include EventQueue::MessageHandler
|
||||
before_save :notify_friends
|
||||
|
||||
def notify_friends
|
||||
m = MessageHandler.new
|
||||
|
||||
@@queue = MessageHandler.new
|
||||
xml = prep_webhook
|
||||
#friends_with_permissions.each{ |friend| puts friend; Curl.post( "\"" + xml + "\" " + friend) }
|
||||
m.add_post_request( friends_with_permissions, xml )
|
||||
m.process
|
||||
@@queue.add_post_request( friends_with_permissions, xml )
|
||||
@@queue.process
|
||||
end
|
||||
|
||||
def prep_webhook
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
class MessageHandler
|
||||
|
||||
|
||||
NUM_TRIES = 3
|
||||
TIMEOUT = 5 #seconds
|
||||
|
||||
|
|
@ -61,4 +60,3 @@
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue