GraphQL::Dataloader instances are created for each query (or multiplex) and they:

During a query, you can access the dataloader instance with:

Fiber Lifecycle Hooks

Under the hood, Dataloader creates Fibers as-needed and uses them to run GraphQL and load data from Source classes. You can hook into these Fibers through several lifecycle hooks. To implement these hooks, create a custom subclass and provide new implementation for these methods:

class MyDataloader < GraphQL::Dataloader # or GraphQL::Dataloader::AsyncDataloader
  # ...

Then, use your customized dataloader instead of the built-in one:

  class MySchema < GraphQL::Schema
-   use GraphQL::Dataloader
+   use MyDataloader