Created
July 6, 2018 20:18
-
-
Save jtcrank/6435843efb2aaaf45acfb4f42afc6433 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This is just a quick example. It may seem odd but its the general gist of what im trying to do | |
## Main method | |
def aggregate_data(user_id:) | |
user = User.where(id: user_id) | |
posts = Concurrent::Future.execute { PostService.new.get_user_posts(user_id: user_id) } | |
comments = Concurrent::Future.execute { CommentService.new.get_user_comments(user_id: user_id) } | |
ReportingService.new.process_and_format_data(user: user, posts: posts.value, comments: comments.value) | |
end | |
class PostService | |
end | |
class CommentService | |
end | |
class ReportingService | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment