Skip to content

Subscriber api without count when the query number is more than subscriber count. #8196

@KomachiSion

Description

@KomachiSion

Describe the bug
A clear and concise description of what the bug is.

The API /nacos/v1/ns/service/subscribers will return count 0 when the query number is more than subscriber count.

For example, service A has 5 subscribers, but when we query with pageNo=2&pageSize=1000, the result will be count=0, which is not expected.

The reason is the end will be smaller than start and so that subList throw exception.

            int count = subscribers.size();
            if (end > count) {
                end = count;
            }

Expected behavior
return right count number of subscribers.

Acutally behavior
return 0

How to Reproduce
Steps to reproduce the behavior:

  1. subscriber any service.
  2. call /nacos/v1/ns/service/subscribers with pageNo=2&pageSize=1000
  3. see the response count field

Desktop (please complete the following information):

  • Version nacos-server 2.X
  • Module naming

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions