-
Notifications
You must be signed in to change notification settings - Fork 637
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
make PAGE_SIZE configurable for Slack API list calls #612
Conversation
src/client.coffee
Outdated
@@ -43,6 +44,9 @@ class SlackClient | |||
@rtm = new RtmClient options.token, options.rtm | |||
@web = new WebClient options.token, { maxRequestConcurrency: 1 } | |||
|
|||
unless isNaN(options.apiPageSize) | |||
SlackClient.PAGE_SIZE = parseInt(options.apiPageSize, 10) |
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 know this approach is a pretty easy way to make this work. However, now that the value is no longer a constant, we may want to use an instance filed like @page_size
over a class field plus replace the references to SlackClient.PAGE_SIZE
in the code.
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, yeah I was thinking that too, needed someone to confirm my own doubt. I used @apiPageSize to follow existing camelCase naming convention.
@kintarowins Thanks a lot for promptly updating the PR. Right now, I'm a bit busy for other tasks but I will be checking if this change works as we expect. By the way, can you sign our CLA (see the above bot message for details)? 🙇 Without it, we are unable to merge your change. |
Signed. I changed default page size to 200 too, what do you think or should it be higher? |
@kintarowins Thanks for signing it. Regarding the page size, I am reluctant to change the default value for keeping backward compatibility. Your change enables developers to customize the size. Let's keep the default as-is. I did not have time to do some tests today but I'll check this sometime this week. |
I just verified if your change works with my Hubot example apps. Before merging this pull request, I will migrate the CI builds to GitHub Actions. Thanks for your contribution! |
Codecov Report
@@ Coverage Diff @@
## main #612 +/- ##
==========================================
- Coverage 84.23% 83.82% -0.42%
==========================================
Files 6 6
Lines 406 408 +2
Branches 90 91 +1
==========================================
Hits 342 342
- Misses 37 38 +1
- Partials 27 28 +1
Continue to review full report at Codecov.
|
Summary
Describe the goal of this PR. Mention any related Issue numbers.
Requirements (place an
x
in each[ ]
)