Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a custom wrapper around #perform #160

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/graphql/batch/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/graphql/batch/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module GraphQL
module Batch
VERSION = "0.5.2"
VERSION = "0.5.3"
end
end