Modify getChannelId
and convertChannelNameToId
for efficient channel ID retrieval
#977
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the latest plugin ( https://github.com/jenkinsci/slack-plugin/releases/tag/715.v1cfed1b_9c63c ), the following
slackUploadFile()
cannot finish in my environment, which has roughly 5300 public/private channels.slackUploadFile()
internally causesRate limited by Slack, retrying in 30000ms
many times.If a channel is specified by its ID,
getChannelId()
can avoid manyconversations.list
calls. 894f6ea allowsgetChannelId()
to return immediately ifchannelName
matches the pattern of ID.I also experimentally found that
conversations.list
withtypes=public_channel,private_channel
requires much more API calls thanconversations.list
with two separatetypes=public_channel
andtypes=private_channel
. 48d9152 splitsconvertChannelNameToId()
into two methods, one fortypes=public_channel
and another fortypes=private_channel
. A new parameterlimit=999
is also added to reduce API calls further.Testing done
The code was packaged by
mvn package
and passed existing tests. The resulting hpi was installed on a jenkins server (version 2.460) and was confirmed to run correctly.Submitter checklist