-
-
Notifications
You must be signed in to change notification settings - Fork 766
Add support for limit and offset in list_values method #5176
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
Conversation
We just reformatted the code with black. (Hooray!) And this PR got caught in the cross fire too. (Arrgh!) |
@cognifloyd Can you please also point @anirudhbagri in the right direction to finish this PR? |
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.
I'm just reviewing this. My first question was, what defines the default limit? It looks like it's defined in config:
Lines 43 to 44 in 56101b8
# Maximum limit (page size) argument which can be specified by the user in a query string. | |
max_page_size = 100 |
Lines 84 to 89 in 8496bb2
cfg.IntOpt( | |
"max_page_size", | |
default=100, | |
help="Maximum limit (page size) argument which can be " | |
"specified by the user in a query string.", | |
), |
st2/st2api/st2api/controllers/resource.py
Lines 126 to 129 in 8496bb2
# Maximum value of limit which can be specified by user | |
@property | |
def max_limit(self): | |
return cfg.CONF.api.max_page_size |
So, could we use the default from the config?
Let's see. I think we'll also need some tests for this feature. It looks like this is where the list_values() tests are:
Oh, and I guess that's also the test that is failing: https://github.com/StackStorm/st2/pull/5176/checks?check_run_id=2063056481#step:14:2287 Plus, I think we'll need a test for the st2client bit. |
Oh. And I often forget adding a changelog entry. Please do that too. Then I think this will be good to merge :) |
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, @anirudhbagri for the contribution and @cognifloyd for review and making this PR complete 👍
@Kami would also appreciate your final 👀 and ✔️ as someone involved in previous pagination discussions around this specific issue.
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.
LGTM
@@ -195,6 +196,9 @@ def get_all(self, **kwargs): | |||
if user: | |||
params["user"] = user | |||
|
|||
if offset: |
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.
Since if we use a truthy check, this means offset
won't be included if set to 0
, but yeah I think this should be fine since that's the current / existing default behavior if offset
is not specified.
I have upgraded to latest Stackstorm 3.8 version and I am getting also this issue. Any fix?
My workflow_clean.py
Temporary Fix
|
Added ability to provide limit and offset for
list_values()
.Partially fixes #5097 and fixes #5171.