Skip to content

Commit

Permalink
await bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
rmnoon committed Jun 21, 2022
1 parent 0cd8b0a commit 81c9af2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021
"ecmaVersion": 2021,
"project": "./tsconfig.json"
},
"extends": [
"plugin:@typescript-eslint/recommended"
Expand All @@ -10,6 +11,7 @@
"indent": ["error", "tab", { "SwitchCase": 1 }],
"semi": [2, "always"],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off"
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-floating-promises": "error"
}
}
12 changes: 6 additions & 6 deletions src/api/_acks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function checkForReminders() {
const incomplete: { channel: string, ts: string }[] = [];

// check each of them
map(vals, async (val, idx) => {
await map(vals, async (val, idx) => {
const [channel, ts] = val.split(':');
console.log('checkForReminders val: ', { channel, ts, val, idx });
try {
Expand All @@ -55,7 +55,7 @@ export async function checkForReminders() {
incomplete.push({ channel, ts });
}
} catch (e) {
console.error('checkForReminders error: ', { error: e, val });
console.error('checkForReminders error: ', { error: e, val, idx });
}
}, DEFAULT_CONCURRENCY);

Expand All @@ -74,7 +74,7 @@ async function saveReminders(reminders: { channel: string, ts: string }[]): Prom
const score = new Date().getTime();
const adds = reminders.map(r => ({ score, member: `${r.channel}:${r.ts}` }));
const first = adds.shift();
redis.zadd(REDIS_ACK_KEY, first, ...adds); // dirty hack because these typings are disgusting
await redis.zadd(REDIS_ACK_KEY, first, ...adds); // dirty hack because these typings are disgusting
}

export async function checkMessageAcks(channel: string, ts: string, saveReminder = true): Promise<{ isComplete: boolean }> {
Expand Down Expand Up @@ -102,10 +102,10 @@ export async function checkMessageAcks(channel: string, ts: string, saveReminder
usersDidReact.add(u);
}
}

4;
const usersShouldReact = new Set(mentions.userIds);

map(mentions.userGroupIds, async groupId => {
await map(mentions.userGroupIds, async groupId => {
const groupResp = await slack.usergroups.users.list({
usergroup: groupId
});
Expand Down Expand Up @@ -138,7 +138,7 @@ export async function checkMessageAcks(channel: string, ts: string, saveReminder

await log({ channel, threadTs: ts }, 'ready to send reminders', { message, mentions, reactions, usersDidReact: [...usersDidReact], usersShouldReact: [...usersShouldReact], usersToPing });

map(usersToPing, async userToPing => {
await map(usersToPing, async userToPing => {
await slack.chat.postMessage({
channel: userToPing,
text: `Hey <@${userToPing}>! Heads up that <@${message.user}> requested you acknowledge their message by reacting to it: ${permalink}`
Expand Down

1 comment on commit 81c9af2

@vercel
Copy link

@vercel vercel bot commented on 81c9af2 Jun 21, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

ackbot – ./

ackbot-git-main-rmnoon.vercel.app
ackbot.vercel.app
ackbot-rmnoon.vercel.app

Please sign in to comment.