made a pubsubhub constant

This commit is contained in:
maxwell 2010-07-16 12:42:36 -07:00
parent 4160baa25e
commit 99f7e938fd
3 changed files with 7 additions and 5 deletions

View file

@ -1,11 +1,14 @@
development: development:
debug: false debug: false
socket_port: 8080 socket_port: 8080
pubsub_server: 'https://pubsubhubbub.appspot.com/'
test: test:
debug: false debug: false
socket_port: 8081 socket_port: 8081
pubsub_server: 'https://pubsubhubbub.appspot.com/'
production: production:
debug: false debug: false
socket_port: 8080 socket_port: 8080
pubsub_server: 'https://pubsubhubbub.appspot.com/'

View file

@ -58,7 +58,7 @@ module Diaspora
def push_to(recipients) def push_to(recipients)
@@queue.add_hub_notification('http://pubsubhubbub.appspot.com/', User.owner.url + self.class.to_s.pluralize.underscore + '.atom') @@queue.add_hub_notification(APP_CONFIG[:pubsub_server], User.owner.url + self.class.to_s.pluralize.underscore + '.atom')
unless recipients.empty? unless recipients.empty?
recipients.map!{|x| x = x.url + "receive/"} recipients.map!{|x| x = x.url + "receive/"}
@ -132,7 +132,7 @@ module Diaspora
def self.endpoints def self.endpoints
<<-XML <<-XML
<link href="http://pubsubhubbub.appspot.com/" rel="hub"/> <link href="#{APP_CONFIG[:pubsub_server]}" rel="hub"/>
XML XML
end end

View file

@ -2,7 +2,7 @@ class MessageHandler
NUM_TRIES = 3 NUM_TRIES = 3
TIMEOUT = 5 #seconds TIMEOUT = 5 #seconds
def initialize def initialize
@queue = EM::Queue.new @queue = EM::Queue.new
end end
@ -18,7 +18,6 @@ class MessageHandler
end end
def add_hub_notification(destination, feed_location) def add_hub_notification(destination, feed_location)
puts "going to: #{destination}, telling it to fetch #{feed_location}"
@queue.push(Message.new(:pubhub, destination, feed_location)) @queue.push(Message.new(:pubhub, destination, feed_location))
end end
@ -33,7 +32,7 @@ class MessageHandler
http.callback {send_to_seed(query, http.response); process} http.callback {send_to_seed(query, http.response); process}
when :pubhub when :pubhub
http = EventMachine::PubSubHubbub.new(query.destination).publish query.body, :timeout => TIMEOUT http = EventMachine::PubSubHubbub.new(query.destination).publish query.body, :timeout => TIMEOUT
http.callback { puts "boner city"; process} http.callback { process}
else else
raise "message is not a type I know!" raise "message is not a type I know!"
end end