Module: Pipeloader::ARPatch

Defined in:
lib/pipeloader/ar_patch.rb

Overview

Monkey-patch: while a Pipeloader dataloader is active (i.e. during GraphQL response building), route SELECTs through the pipelining Source instead of executing them synchronously. Everything else falls through to AR untouched.

Defined Under Namespace

Modules: Methods

Class Method Summary collapse

Class Method Details

.install!Object



6
7
8
9
10
11
12
13
# File 'lib/pipeloader/ar_patch.rb', line 6

def self.install!
  return if @installed

  # select_all lives on QueryCache (ahead of AbstractAdapter in the chain),
  # so prepend there to intercept before AR's own query cache.
  ActiveRecord::ConnectionAdapters::QueryCache.prepend(Methods)
  @installed = true
end