Flowable taskQuery always returns 128 items

I have a Spring Boot Project where I use flowable.

I have also added flowable-REST to automatically expose flowable REST APIs.

I am trying to write a piece of code to get the list of Task which I am doing by autowiring TaskService and the code is as follows.

TaskQuery query = taskService.createTaskQuery()
.taskCandidateGroup("cg3")
.active()
.includeProcessVariables();

query.count(); // This returns 128 max

If I run the list() method on this query object, it returns me the List<Task> fine but the list only contains items where as it actually has 10586 items.

I confirm this by hitting the equivalent REST API (find below) which shows the total count as 10586.

localhost:8080/process-api/runtime/tasks?candidateGroup=cg3&includeProcessVariables=true&active=true

How can I get all the items?