Skip to content

Fix #676 Add an easier way to access Events API retry info - #677

Merged
seratch merged 2 commits into
slackapi:mainfrom
seratch:issue-676-event-retries
Jan 28, 2021
Merged

Fix #676 Add an easier way to access Events API retry info#677
seratch merged 2 commits into
slackapi:mainfrom
seratch:issue-676-event-retries

Conversation

@seratch

Copy link
Copy Markdown
Contributor

This pull request enables Events API listeners to access x-slack-retry-num / x-slack-retry-reason header values (retry_attempt / retry_reason in Socket Mode) in the following way.

app.event(AppMentionEvent.class, (req, ctx) -> {
Integernum = ctx.getRetryNum(); // 0-3Stringreason = ctx.getRetryReason(); // timeout, http_error etcreturnctx.ack();
});

Fixes#676

Category (place an x in each of the [ ])

  • bolt (Bolt for Java)
  • bolt-socket-mode (Bolt for Java - optional modules)
  • slack-api-client (Slack API Clients)
  • slack-api-model (Slack API Data Models)
  • slack-api-*-kotlin-extension (Kotlin Extensions for Slack API Clients)
  • slack-app-backend (The primitive layer of Bolt for Java)

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to the those rules.

@seratchseratch added enhancement M-T: A feature request for new functionality project:bolt labels Jan 28, 2021
@seratchseratch added this to the 1.6.0 milestone Jan 28, 2021
@seratchseratch self-assigned this Jan 28, 2021
private String channelId;

// X-Slack-Retry-Num: 2 in HTTP Mode
// "retry_attempt": 0, in Socket Mode

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevengill@mwbrooks
The names are a bit different here. Do we prefer retryAttempt? I personally feel retryNum is fine as it's a number.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd personally prefer to keep the names consistent between the headers and variables. It makes it easier to understand that the two are identical and intended to match. So I'd lean toward retryNum as well.

@codecov

codecovBot commented Jan 28, 2021

Copy link
Copy Markdown

Codecov Report

Merging #677 (8c6a5e5) into main (10165f6) will increase coverage by 0.06%.
The diff coverage is 88.88%.

Impacted file tree graph

@@ Coverage Diff @@## main #677 +/- ##
============================================
+ Coverage 78.79% 78.86% +0.06% - Complexity 3052 3060 +8 
============================================
Files 331 331 Lines 8830 8847 +17 Branches 833 839 +6 ============================================
+ Hits 6958 6977 +19 + Misses 1364 1363 -1 + Partials 508 507 -1 
Impacted FilesCoverage ΔComplexity Δ
...m/slack/api/bolt/request/builtin/EventRequest.java77.58% <83.33%> (+1.49%)17.00 <0.00> (+4.00)
...t/socket_mode/request/SocketModeRequestParser.java100.00% <100.00%> (ø)6.00 <0.00> (+2.00)
...i/methods/metrics/impl/MemoryMetricsDatastore.java92.95% <0.00%> (+1.40%)42.00% <0.00%> (+1.00%)
.../com/slack/api/bolt/socket_mode/SocketModeApp.java81.66% <0.00%> (+3.33%)13.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 10165f6...8c6a5e5. Read the comment docs.

private String channelId;

// X-Slack-Retry-Num: 2 in HTTP Mode
// "retry_attempt": 0, in Socket Mode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd personally prefer to keep the names consistent between the headers and variables. It makes it easier to understand that the two are identical and intended to match. So I'd lean toward retryNum as well.

@seratch
seratch merged commit 841bffb into slackapi:mainJan 28, 2021
@seratch
seratch deleted the issue-676-event-retries branch January 28, 2021 22:19
@sagar-ranglani

Copy link
Copy Markdown

Any plans on adding this for boltjs?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementM-T: A feature request for new functionalityproject:bolt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an easier way to access X-Slack-Retry-Num / X-Slack-Retry-Reason in Bolt apps

3 participants

@seratch@sagar-ranglani@mwbrooks