mirror of
https://github.com/kou029w/daraz-san.git
synced 2025-01-18 16:08:06 +00:00
fix: 再試行抑制
This commit is contained in:
parent
13e6b8ac23
commit
4e9ff3cb8f
1 changed files with 22 additions and 2 deletions
24
app.js
24
app.js
|
@ -1,10 +1,30 @@
|
|||
const { App } = require("@slack/bolt");
|
||||
const { promisify } = require("util");
|
||||
const { App, ExpressReceiver } = require("@slack/bolt");
|
||||
const daraz = require("./");
|
||||
|
||||
class Receiver extends ExpressReceiver {
|
||||
/**
|
||||
* @param {import("express").Request} req
|
||||
* @param {import("express").Response} res
|
||||
*/
|
||||
requestHandler(req, res) {
|
||||
// NOTE: See also https://api.slack.com/events-api#errors
|
||||
res.header("x-slack-no-retry", "1");
|
||||
if (req.headers["x-slack-retry-reason"] === "http_timeout")
|
||||
return promisify(res.end)();
|
||||
|
||||
return super.requestHandler(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
const receiver = new Receiver({
|
||||
signingSecret: process.env.SLACK_SIGNING_SECRET,
|
||||
});
|
||||
|
||||
const app = daraz(
|
||||
new App({
|
||||
token: process.env.SLACK_BOT_TOKEN,
|
||||
signingSecret: process.env.SLACK_SIGNING_SECRET,
|
||||
receiver,
|
||||
})
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue