-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
DGS-11414: add pagination for get all subjects #3455
base: 7.7.x
Are you sure you want to change the base?
Conversation
🎉 All Contributor License Agreements have been signed. Ready to merge. |
This comment has been minimized.
This comment has been minimized.
0c4a776
to
29b3bf4
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
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 @djibodu , left some comments
public int normalizeSchemaLimit(int suppliedLimit) { | ||
int limit = schemaSearchDefaultLimit; | ||
if (suppliedLimit > 0 && suppliedLimit <= schemaSearchMaxLimit) { | ||
limit = suppliedLimit; | ||
} | ||
return limit; | ||
} | ||
|
||
public int normalizeSubjectLimit(int suppliedLimit) { | ||
int limit = subjectSearchDefaultLimit; | ||
if (suppliedLimit > 0 && suppliedLimit <= subjectSearchMaxLimit) { |
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.
Let's combine these into one method that takes a default
public int normalizeLimit(int suppliedLimit, int defaultLimit)
limit = schemaRegistry.normalizeSubjectLimit(limit); | ||
|
||
stream = stream.skip(offset).limit(limit); | ||
return stream.collect(Collectors.toCollection(LinkedHashSet::new)); // preserve order |
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.
nit: can be
return subjects.stream() // add newline
.skip(offset)
.limit(offset)
.collect(...);
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.
Also, let's change the schemas pagination to use the same logic
29b3bf4
to
d76b263
Compare
What
Adding pagination for getAllSubjects. Default and max limit both set to 20,000
Checklist
References
JIRA:
Test & Review
Open questions / Follow-ups