diff --git a/lib/graphql/batch/loader.rb b/lib/graphql/batch/loader.rb index 11da284..fca03ec 100644 --- a/lib/graphql/batch/loader.rb +++ b/lib/graphql/batch/loader.rb @@ -66,12 +66,21 @@ def resolve #:nodoc: return if resolved? load_keys = queue @queue = nil - perform(load_keys) + + around_perform do + perform(load_keys) + end + check_for_broken_promises(load_keys) rescue => err reject_pending_promises(load_keys, err) end + # Interface to add custom code for purposes such as instrumenting the performance of the loader. + def around_perform + yield + end + # For Promise#sync def wait #:nodoc: if executor diff --git a/lib/graphql/batch/version.rb b/lib/graphql/batch/version.rb index 41c95ba..c39cc2e 100644 --- a/lib/graphql/batch/version.rb +++ b/lib/graphql/batch/version.rb @@ -1,5 +1,5 @@ module GraphQL module Batch - VERSION = "0.5.2" + VERSION = "0.5.3" end end