Skip to content

When dispatchPredicate condition evaluates to false, shouldDispatch should return false #138

Closed

Description

@srinivasankavitha

Describe the bug
The default policy when using ScheduledDispatchRegistry is DISPATCH_ALWAYS. However, when a dispatch predicate is set for a data loader, the shouldDispatch method should return false if the condition evaluates to false. Current behavior is that it falls through to the overall DISPATCH_ALWAYS predicate when the dataloader's dispatch predicate evaluates to false: https://github.com/graphql-java/java-dataloader/blob/master/src/main/java/org/dataloader/registries/ScheduledDataLoaderRegistry.java#L219

Is it expected that we always set an explicit overall dispatch predicate (different from DISPATCH_ALWAYS) that would serve as a backup? Currently I have to set it to either DISPATCH_NEVER or some other reasonable default that would eventually be applied so that the individual data loader dispatch predicates get a chance to be applied.

Activity

  1. bbakerman commented on Apr 13, 2024

    @bbakerman
    Member

    I think you are right - the current code does a fall back to an overall DispatchPredicate if it never returns true but looking at it now on reflection, if there is a specific DispatchPredicate registered for a DataLoader it should take precedence and be the final answer. After all it was specifically set on that data loader.

    I am going to change this.

  2. added this to the 3.3.0 milestone on Apr 13, 2024
  3. bbakerman commented on Apr 13, 2024

    @bbakerman
    Member

    This is now fixed

  4. srinivasankavitha commented on Apr 14, 2024

    @srinivasankavitha
    Author

    Great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions