Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thread capabilities for async requests. #117

Open
omarps opened this issue Jan 26, 2015 · 4 comments
Open

Add thread capabilities for async requests. #117

omarps opened this issue Jan 26, 2015 · 4 comments

Comments

@omarps
Copy link

omarps commented Jan 26, 2015

Comparing with the Official Javascript Library, this gem is not async, so you can yo and wrap the requests in a Thread implementation (or even Fiber), but it would be nice, if the gem itself provides async methods to improve the performance.

@viniciusoyama
Copy link

Hi @omarps . Are you talking about the node-trello?

I don't think that this is a good idea to bring something like that to this Gem. Node is a event-driven environment. And using threads could potentially increase the complexity of the Gem. Also it will only be helpful in worker jobs as in normal HTTP requests we usually don't have anything to postpone the response.

I think that the best approach is to create something new using event machine if that's what your talking about.

What do you think? =]

@omarps
Copy link
Author

omarps commented Feb 27, 2015

Hi @viniciusoyama, I'm refering to the kind execution process that is made when you use the Trello's JavaScript API.

For example, you could launch a method to get some boards and in the callback method, start querying for the lists' cards.

I have a project that navigates thought the Board/List/Cards/Users hierarchy that works pretty well, but when I tried to migrate the logic to to a Rails Project and start using the ruby-trello gem, it takes longer than expected just to load the Boards.

That's what am I asking for some thread approach to solve this.

@jeremytregunna
Copy link
Owner

Anyone have any ideas on how to realize this w/o breaking how the API currently works too much? If there are some good ideas here, I'd love to consider them for 2.0. This and #116 would be nice to have a discussion on for 2.0 planning.

@viniciusoyama
Copy link

Hey @jeremytregunna can you help me with some scenarios?

With the current API, if I want to make async operations I have to open threads:

Thread.new do 
  user = Trello::Member.find("user1")
  #save things..
end

Thread.new do 
  user = Trello::Member.find("user2")
  #save things..
end

#...

For 2.0 you want something like this:

Trello::Member.find("user1") do  |user|
  #save things
end

Trello::Member.find("user1") do  |user|
  #save things
end

Is that it? Sorry I'm trying to understand what you guys want in order to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants