Replies: 2 comments
-
When running in an event loop, all fibers will run concurrently, even those created with |
Beta Was this translation helpful? Give feedback.
-
@ioquatix thanks for your reply! The API client prepares the request and yields before executing it, so resuming the fiber will run a blocking HTTP request and return the parsed response. I'm still struggling a bit getting used to Async because there are multiple ways to achieve the same thing. I was wondering whether using an
versus
Because this will be a Map-Reduce kind of operation, I think using Async is better than Sync correct? |
Beta Was this translation helpful? Give feedback.
-
Hello there,
I'm currently working with an API client library that returns fibers for API request (https://github.com/microsoftgraph/msgraph-sdk-ruby). Now I'm wondering how I'd schedule those fibers using Async.
Here's a simplified synchronous example to fetch users and its calendar events:
How would I run this asynchronously with Async? Here's what I came up with, but it doesn't feel right:
I'm not sure whether
Fiber.schedule { other_fiber.resume }
is correct and whether it's a good idea to manage the scheduler this way i.e. callingFiber.set_scheduler(...)
and callingscheduler.run
manually.Beta Was this translation helpful? Give feedback.
All reactions