Coder Social home page Coder Social logo

Batch support about facebook.ex HOT 10 OPEN

mweibel avatar mweibel commented on June 13, 2024
Batch support

from facebook.ex.

Comments (10)

mweibel avatar mweibel commented on June 13, 2024

looks ok to me, however I'm thinking how we could support both, so that we don't always need to request a batch if not needed.. Do you have an idea?

from facebook.ex.

asolove avatar asolove commented on June 13, 2024

I would prefer to not have two separate versions of each function. One cool feature of other libraries I've worked with is that you can open a batch, call functions that make requests, and have them automatically batched up without knowing they're participating in the batch. Not sure how to make that happen in Elixir.

from facebook.ex.

mweibel avatar mweibel commented on June 13, 2024

Could you show me such a library so I'd get a clearer view how they're doing that?

from facebook.ex.

asolove avatar asolove commented on June 13, 2024

The specific example I know best is koala in ruby. Here's a simple snippet:

@graph.batch do |batch_api|
  # Assuming you have database fields "about_me" and "photos"
  batch_api.get_object('me')                {|me|     self.about_me = me }
  batch_api.get_connections('me', 'photos') {|photos| self.photos   = photos }
end

In this case the two calls to the batch api get put together, the responses to the batch are taken apart and the correct one is fed to each block and the block called before the batch call finishes.

In Elixir's semantics, we'd probably want to do that differently, and I don't know how. But doing large-scale work with Facebook without batching is going to be painful.

from facebook.ex.

mweibel avatar mweibel commented on June 13, 2024

Hey,
sorry for not coming back to you earlier. Sounds like a cool API but I'm unsure as well how to do that (without some macro stuff which makes it a bit harder to follow the code).
So I propose for now to go for the first proposal you had. Do you agree?

from facebook.ex.

mweibel avatar mweibel commented on June 13, 2024

ping @asolove

from facebook.ex.

asolove avatar asolove commented on June 13, 2024

I'm no longer working on the project this was intended for. Batch support is still a great idea for serious users of the FB API, but I don't have much insight into how to implement it, so I will just close this.

from facebook.ex.

paulruescher avatar paulruescher commented on June 13, 2024

I was looking into this the other day, and if I have some free time I might dig into batch support. Is it possible to re-open this?

I think @tfinnell is working on implementing HTTPoison, so I wanted to check in and see if that's happening in the near-future. If so, I might hold off for a bit.

from facebook.ex.

tfinnell avatar tfinnell commented on June 13, 2024

I'll likely have a PR put together in the next few days as I get time to work more on it.

This would be interesting to implement and I'm wondering if it could be done without having to swap responses for requests, but rather intercept and rewrite the requests (exvcr is doing a similar interception I believe).

from facebook.ex.

paulruescher avatar paulruescher commented on June 13, 2024

I'm sure we can do some pattern matching magic to accomplish this. I'll revisit some time next week. Going to spend a bit of time on one of my projects.

from facebook.ex.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.