Skip to content

Thread count increased after usage of ScheduledDataLoaderRegistry #173

Closed as not planned
@Ruch12

Description

@Ruch12

Describe the bug
We've merged the latest version after validating the fix was deployed - #135 yet the thread count has started to increase significantly. The threads aren't getting closed after the completion of the task unlike DataLoaderRegistry.

We've initialized ScheduledDataLoaderRegistry in the following way in the ServiceContextImpl -

    public ScheduledDataLoaderRegistry getScheduledDataLoaderRegistry() {

        if (null == scheduledDataLoaderRegistry) {
            DispatchPredicate dispatchPredicate = DispatchPredicate.dispatchIfLongerThan(Duration.ofMillis(50));
            scheduledDataLoaderRegistry = ScheduledDataLoaderRegistry.newScheduledRegistry()
                    .registerAll(dataLoaderRegistry)
                    .dispatchPredicate(dispatchPredicate)
                    .build();
        }

        return scheduledDataLoaderRegistry;
    }

The issue is that the threads are not getting closed after the execution of the scheduledDataLoaderRegistry and when the response is ready and sent back.

In this case, shouldn't the logic be handled in a way when there is nothing to be dispatched and all data loaders have completed their work, we should close the thread?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions