Comments (13)
Love it! This would be a really nice thing to have, especially since the return format for batch calls is really awkward, what with each response containing a header and code when all you really want is the return data.
from koala.
I'm tentatively thinking implementing batch via a block, something like
graph.batch do
g.op1
g.op2(args)
g.op3
end
The core api method, in batch mode, would queue up requests, and then execute them at the end of the block, returning a (simplified) array of responses as the result of the block.
Open to any thoughts/suggestions!
from koala.
This is be a good idea since we would be able to keep on using regular koala syntax and just have to put it inside a block... So much easier to read!
The only problem I see with this is that - unless I'm missing something obvious - you wouldn't be able to specify a different access token for each request.
Maybe allowing things like the following would fix it:
graph = Koala::Facebook::GraphAPI.new(oauth_access_token)
other_graph = Koala::Facebook::GraphAPI.new(other_oauth_access_token)
Koala::Facebook::GraphAPI::Batch.run do
graph.op1
other_graph.op2
end
... or something like that. I'm not sure if a GraphAPI::Batch module is required or if using what's already in the lib would be enough.
from koala.
Great catch -- I hadn't thought of that use case, but it's a necessary and important one. I'll go the way you've proposed. I don't yet know if we'll add a batch module or just add a class-level batch method -- I'll sketch out my thoughts and post them here tomorrow, most likely.
from koala.
FYI, this will be part of release 1.1, which will be either late this month or sometime next month. Just got the last big 1.0 issue solved, so we'll hopefully get that out with the existing feature-set soon and then start on batch.
from koala.
FYI, I've started a branch for batch requests (https://github.com/arsduo/koala/tree/batch). So far I've laid the groundwork for batch operations by refactored the api method to use blocks heavily, which can then be stored for batch execution or executed immediately in normal use. Next step is to figure out how batch should work -- how to store the data, what response to give, etc. -- and deal with the whole "processing the awkward results" bit.
from koala.
+1
from koala.
Hey everyone,
Good news update! I received a pull request this morning with a complete implementation of the Batch API. I'd been pulled away by an urgent non-Koala project halfway through my own implementation, so this was a nice surprise. seejohnrun implemented batch exactly as we'd been discussing and planning, and provided specs.
Note that this is just the basic batch API for a single token. I'll be modifying it as needed over the next week to support multiple tokens, dependencies, and other advance topics.
The diff is here: dea3d36. I'm pulling it into a separate branch now.
I'll be testing this as well as a few other things over the next few days, so feel free to try it out and share any feedback as well.
Alex
from koala.
Hey everyone,
I'm excited to let you know that Batch API support is complete! You can check it out at https://github.com/arsduo/koala/tree/batch. Big thanks to seejohnrun for his help, and to those who've sent feedback on the earlier versions.
We support all the Batch API features (basic batch operations, multiple access tokens, errors in results, dependencies, and uploading binary files). There's no documentation yet, but the specs for the Batch API contain easy-to-follow examples of everything it can do. You should, of course, also read Facebook's Batch API documentation, too (http://developers.facebook.com/docs/api/batch/).
If you have some time and energy, point your Gemfile to the git branch and give the Batch API a try. We'll be merging it into master soon and releasing the next version as a release candidate around the end of the month, hopefully, and I'll be glad for any feedback between now and then (or later, of course).
Cheers,
Alex
from koala.
Is anyone getting "IOError: Connection reset by peer" when using batch calls?
from koala.
I haven't seen that. Is it still happening?
On Nov 19, 2011, at 10:53 PM, Sol Eun wrote:
Is anyone getting "IOError: Connection reset by peer" when using batch calls?
Reply to this email directly or view it on GitHub:
#50 (comment)
from koala.
@soleun: I get that every once in a while. It's due to Facebook API's general instability. Also there were additional stability issues with the BatchAPI a few days back: http://developers.facebook.com/bugs/308579742503979?
from koala.
@marcgg Thanks for the response. I got around this by not keeping the connection open for too long.
from koala.
Related Issues (20)
- Facebook Graph API v2.5 Deprecated HOT 2
- auth.info.image for facebook returns a generic user icon
- Getting page posts returns an empty array HOT 2
- Page Access Token Error? HOT 6
- Testing with Koala fail by execution expired HOT 1
- put_video not showing on wall, but shows in videos library.
- fbtrace_id is not passed correctly to Koala::Error
- Unable to post visitor post to a facebook page using graph API. HOT 2
- Hellpp HOT 3
- Undefined Method "alias_method_chain" HOT 1
- Graph API v2.8 is going to be Deprecated on Apr 18, 2019. HOT 2
- Facebook deprecated befriend API from v4.0
- Koala::Facebook::ServerError on requesting for higher limit of IG posts HOT 2
- NoMethodError (undefined method `scheme' for "https://graph.facebook.com":String): HOT 2
- please update the graph_collection, the next_page & previous_page are not working HOT 2
- Koala breaks with faraday 2.0 release `File does not exist: net/http/post/multipart` HOT 5
- How to post a content to my group on Facebook ? HOT 1
- GraphErrorChecker#response_hash returns nil causing gem to crash HOT 3
- Facing Koala::Facebook::OAuthTokenRequestError when fetching app_access_token HOT 6
- Not compatible with faraday-net_http_persistent
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from koala.