forked from ratmie/times-all-bot-lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Slackリトライによるtimes-allへの重複投稿を防止 #51
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a33b5d5
fix: Slackリトライリクエストをスキップして重複投稿を防止
eai04191 9ebb5b0
fix: handlerのevent型をAPIGatewayProxyEventV2に修正してanyキャストを除去
eai04191 227d279
refactor: handler.tsからas anyキャストを除去
eai04191 d8d6aa6
fix: リトライスキップをhttp_timeoutのみに限定して取りこぼしを防止
eai04191 e37dbe0
refactor: slackRetryテストをsrc/lib/__tests__/に移動して慣習に合わせる
eai04191 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import assert from 'node:assert/strict'; | ||
| import { describe, it } from 'node:test'; | ||
| import { isSlackRetry } from '../lib/slackRetry.ts'; | ||
|
|
||
| describe('isSlackRetry', () => { | ||
|
eai04191 marked this conversation as resolved.
Outdated
|
||
| it('x-slack-retry-numヘッダーがある場合はtrueを返す', () => { | ||
| const headers = { | ||
| 'x-slack-retry-num': '1', | ||
| 'x-slack-retry-reason': 'http_timeout', | ||
| }; | ||
| assert.equal(isSlackRetry(headers), true); | ||
| }); | ||
|
|
||
| it('x-slack-retry-numヘッダーがない場合はfalseを返す', () => { | ||
| const headers = { | ||
| 'content-type': 'application/json', | ||
| }; | ||
| assert.equal(isSlackRetry(headers), false); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import type { APIGatewayProxyEventV2 } from 'aws-lambda'; | ||
|
|
||
| export function isSlackRetry( | ||
| headers: APIGatewayProxyEventV2['headers'], | ||
| ): boolean { | ||
| return !!headers['x-slack-retry-num']; | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.