From eea7871c22c7f7569657da5146f2ddfd937a1504 Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Mon, 18 Dec 2023 18:59:14 -0500 Subject: [PATCH] Add note about rails isolation_level --- guides/dataloader/async_dataloader.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/guides/dataloader/async_dataloader.md b/guides/dataloader/async_dataloader.md index a9186fd420..1ef117f224 100644 --- a/guides/dataloader/async_dataloader.md +++ b/guides/dataloader/async_dataloader.md @@ -22,6 +22,17 @@ __Also__, add [the `async` gem](https://github.com/socketry/async) to your proje bundle add async ``` -That's it! Now, {{ "GraphQL::Dataloader::AsyncDataloader" | api_doc }} will create `Async::Task` instances instead of plain `Fiber`s and the `async` gem will manage parallelism. +Now, {{ "GraphQL::Dataloader::AsyncDataloader" | api_doc }} will create `Async::Task` instances instead of plain `Fiber`s and the `async` gem will manage parallelism. For a demonstration of this behavior, see: [https://github.com/rmosolgo/rails-graphql-async-demo](https://github.com/rmosolgo/rails-graphql-async-demo) + +## Rails + +For Rails, you'll also want to configure Rails to use Fibers for isolation: + +```ruby +class Application < Rails::Application + # ... + config.active_support.isolation_level = :fiber +end +```