a cache for slack profile pictures and emojis

feat: add a slack bottleneck for large loads

bun.lockb

This is a binary file and will not be displayed.

+1
package.json
···
"@sentry/bun": "^8.45.0",
"@tqman/nice-logger": "^1.0.7",
"@types/node-cron": "^3.0.11",
"elysia": "latest",
"node-cron": "^3.0.3"
},
···
"@sentry/bun": "^8.45.0",
"@tqman/nice-logger": "^1.0.7",
"@types/node-cron": "^3.0.11",
+
"bottleneck": "^2.19.5",
"elysia": "latest",
"node-cron": "^3.0.3"
},
+6
src/slackWrapper.ts
···
SlackUserInfoResponse,
} from "./slack";
/**
* Interface for mapping emoji names to their URLs
*/
···
class SlackWrapper {
private signingSecret: string;
private botToken: string;
/**
* Creates a new SlackWrapper instance
···
SlackUserInfoResponse,
} from "./slack";
+
import Bottleneck from "bottleneck";
+
/**
* Interface for mapping emoji names to their URLs
*/
···
class SlackWrapper {
private signingSecret: string;
private botToken: string;
+
private limiter = new Bottleneck({
+
maxConcurrent: 10,
+
minTime: 10, // 100 requests per second
+
});
/**
* Creates a new SlackWrapper instance