-
Notifications
You must be signed in to change notification settings - Fork 93
Lazily initialize Executor in ScheduledDataLoaderRegistry builder #135
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
Conversation
Calling ScheduledDataLoaderRegistry.newScheduledRegistry would create a new ScheduledExecutorService on every call, regardless of whether a custom one was supplied. Move creation of the default ScheduledExecutorService from the builder field to the build method to avoid the issue.
This fix is important for services that have high RPS since the current implementation creates a new instance of the ScheduledExecutorService every time a request is processed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this fix - I agree this is better situation
@bbakerman - Thanks for merging the PR! When would the next release be available? |
3.2.2 is now released |
Will there also be a graphql-java release with this update soon? |
No
…On Wed, Nov 15, 2023, 5:31 AM Kavitha Srinivasan ***@***.***> wrote:
Will there also be a graphql-java release with this update?
—
Reply to this email directly, view it on GitHub
<#135 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMVWSNKX4FJNX4QM255JPLYEO2HBAVCNFSM6AAAAAA7GUJAEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJQHA4TKNRZGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
…ain) (#17708) [](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.graphql-java:java-dataloader](https://togithub.com/graphql-java/java-dataloader) | `3.2.0` -> `3.3.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>graphql-java/java-dataloader (com.graphql-java:java-dataloader)</summary> ### [`v3.3.0`](https://togithub.com/graphql-java/java-dataloader/releases/tag/v3.3.0): 3.3.0 [Compare Source](https://togithub.com/graphql-java/java-dataloader/compare/v3.2.2...v3.3.0) #### What's Changed - Pre-size resulting lists by [@​dfa1](https://togithub.com/dfa1) in [https://github.com/graphql-java/java-dataloader/pull/142](https://togithub.com/graphql-java/java-dataloader/pull/142) - Minor javadoc fixes by [@​dfa1](https://togithub.com/dfa1) in [https://github.com/graphql-java/java-dataloader/pull/141](https://togithub.com/graphql-java/java-dataloader/pull/141) - Shuts down executor if its was auto added by our code by [@​bbakerman](https://togithub.com/bbakerman) in [https://github.com/graphql-java/java-dataloader/pull/144](https://togithub.com/graphql-java/java-dataloader/pull/144) - If there is a specific predicate for a dataloader - its is the final say on whether to dispatch by [@​bbakerman](https://togithub.com/bbakerman) in [https://github.com/graphql-java/java-dataloader/pull/145](https://togithub.com/graphql-java/java-dataloader/pull/145) **Full Changelog**: graphql-java/java-dataloader@v3.2.2...v3.3.0 ### [`v3.2.2`](https://togithub.com/graphql-java/java-dataloader/releases/tag/v3.2.2): 3.2.2 [Compare Source](https://togithub.com/graphql-java/java-dataloader/compare/v3.2.1...v3.2.2) #### What's Changed A series of small fixes to make the code more efficient - Lazily initialize Executor in ScheduledDataLoaderRegistry builder by [@​kilink](https://togithub.com/kilink) in [https://github.com/graphql-java/java-dataloader/pull/135](https://togithub.com/graphql-java/java-dataloader/pull/135) - Avoid allocations in DataLoaderHelper.dispatch when there's no work by [@​kilink](https://togithub.com/kilink) in [https://github.com/graphql-java/java-dataloader/pull/136](https://togithub.com/graphql-java/java-dataloader/pull/136) #### New Contributors - [@​kilink](https://togithub.com/kilink) made their first contribution in [https://github.com/graphql-java/java-dataloader/pull/135](https://togithub.com/graphql-java/java-dataloader/pull/135) **Full Changelog**: graphql-java/java-dataloader@v3.2.1...v3.2.2 ### [`v3.2.1`](https://togithub.com/graphql-java/java-dataloader/releases/tag/v3.2.1): 3.2.1 [Compare Source](https://togithub.com/graphql-java/java-dataloader/compare/v3.2.0...v3.2.1) ### New ticker mode There is a new mode in `ScheduledDataLoaderRegistry` called ticker mode that will continue to tick away and allow for chained data loader calls. See the readme for more details. ```java ScheduledDataLoaderRegistry registry = ScheduledDataLoaderRegistry.newScheduledRegistry() .register("a", dataLoaderA) .register("b", dataLoaderB) .scheduledExecutorService(executorService) .schedule(Duration.ofMillis(10)) .tickerMode(true) // ticker mode is on .build(); CompletableFuture<Object> chainedCalls = dataLoaderA.load("user1") .thenCompose(userAsKey -> dataLoaderB.load(userAsKey)); ``` ### Predicates per dataloader in ScheduledDataLoaderRegistry `ScheduledDataLoaderRegistry` now has the capability to have a predicate per data loader specified as well as an overall one. This allows you to have fine control on when dataloaders get dispatched. #### What's Changed - Try.getThrowable - fixed incorrect exception message by [@​rstata](https://togithub.com/rstata) in [https://github.com/graphql-java/java-dataloader/pull/122](https://togithub.com/graphql-java/java-dataloader/pull/122) - Prepend 0.0.0 to build version by [@​dondonz](https://togithub.com/dondonz) in [https://github.com/graphql-java/java-dataloader/pull/126](https://togithub.com/graphql-java/java-dataloader/pull/126) - Batch scheduler function support by [@​bbakerman](https://togithub.com/bbakerman) in [https://github.com/graphql-java/java-dataloader/pull/128](https://togithub.com/graphql-java/java-dataloader/pull/128) - Adds a predicate to DataLoaderRegistry and a per dataloader map of pedicates is also possible by [@​bbakerman](https://togithub.com/bbakerman) in [https://github.com/graphql-java/java-dataloader/pull/133](https://togithub.com/graphql-java/java-dataloader/pull/133) - Ticker mode on ScheduledDataLoaderRegistry by [@​bbakerman](https://togithub.com/bbakerman) in [https://github.com/graphql-java/java-dataloader/pull/131](https://togithub.com/graphql-java/java-dataloader/pull/131) #### New Contributors - [@​rstata](https://togithub.com/rstata) made their first contribution in [https://github.com/graphql-java/java-dataloader/pull/122](https://togithub.com/graphql-java/java-dataloader/pull/122) - [@​dondonz](https://togithub.com/dondonz) made their first contribution in [https://github.com/graphql-java/java-dataloader/pull/126](https://togithub.com/graphql-java/java-dataloader/pull/126) **Full Changelog**: graphql-java/java-dataloader@v3.2.0...v3.2.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 10pm every weekday,before 6am every weekday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/camunda/zeebe). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMTMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjMxMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWVyZ2UiXX0=-->
Calling ScheduledDataLoaderRegistry.newScheduledRegistry would create a new ScheduledExecutorService on every call, regardless of whether a custom one was supplied. Move creation of the default ScheduledExecutorService from the builder field to the build method to avoid the issue. Fixes #134