ryan@rtmlap:~/s$ svn diff vendor/plugins/facebooker/lib/facebooker/
Index: vendor/plugins/facebooker/lib/facebooker/session.rb
===================================================================
--- vendor/plugins/facebooker/lib/facebooker/session.rb (revision 1516)
+++ vendor/plugins/facebooker/lib/facebooker/session.rb (working copy)
@@ -45,7 +45,8 @@
class AlbumIsFull < StandardError; end
class MissingOrInvalidImageFile < StandardError; end
class TooManyUnapprovedPhotosPending < StandardError; end
-
+ class TooManyRequestsInBatch < StandardError; end
+
API_SERVER_BASE_URL = "api.facebook.com"
API_PATH_REST = "/restserver.php"
WWW_SERVER_BASE_URL = "www.facebook.com"
@@ -382,8 +383,15 @@
yield
# Set the batch request to false so that post will execute the batch job
@batch_request=false
- BatchRun.current_batch=@batch_queue
- post("facebook.batch.run",:method_feed=>@batch_queue.map{|q|
q.uri}.to_json,:serial_only=>serial_only.to_s)
+ #facebook only accepts 20 batch messages at once
+ max_batch_requests = 20
+ while @batch_queue && @batch_queue.size > 0 do
+ current_queue = @batch_queue[0,max_batch_requests]
+ @batch_queue = @batch_queue[max_batch_requests,@batch_queue.length-max_batch_requests]
+
+ BatchRun.current_batch=current_queue
+ post("facebook.batch.run",:method_feed=>current_queue.map{|q|
q.uri}.to_json,:serial_only=>serial_only.to_s)
+ end
ensure
@batch_request=false
BatchRun.current_batch=nil
@@ -396,7 +404,7 @@
if batch_request?
add_to_batch(final_params,&proc)
else
- result=service.post(final_params)
+ result =service.post(final_params)
result = yield result if block_given?
result
end
Index: vendor/plugins/facebooker/lib/facebooker/parser.rb
===================================================================
--- vendor/plugins/facebooker/lib/facebooker/parser.rb (revision 1516)
+++ vendor/plugins/facebooker/lib/facebooker/parser.rb (working copy)
@@ -377,13 +377,20 @@
603 => Facebooker::Session::FQLTableDoesNotExist,
604 => Facebooker::Session::FQLStatementNotIndexable,
605 => Facebooker::Session::FQLFunctionDoesNotExist,
- 606 => Facebooker::Session::FQLWrongNumberArgumentsPassedToFunction
+ 606 => Facebooker::Session::FQLWrongNumberArgumentsPassedToFunction,
+ 950 => Facebooker::Session::TooManyRequestsInBatch,
}
def self.process(data)
response_element = element('error_response', data) rescue nil
if response_element
hash = hashinate(response_element)
- raise EXCEPTIONS[Integer(hash['error_code'])].new(hash['error_msg'])
+ exception = EXCEPTIONS[Integer(hash['error_code'])]
+ if exception
+ raise exception.new(hash['error_msg'])
+ else
+ RAILS_DEFAULT_LOGGER.error("\n\n*******New Undocumented Facebook Exception Found******\nError Code:
#{hash['error_code']}\nError Message: #{hash['error_msg']}\n\nPlease report the error code and message to the Facebooker
team at http://rubyforge.org/tracker/?atid=16130&group_id=4187&func=browse")
+ raise response_element.inspect
+ end
end
end
end
|