Skip to content

Commit

Permalink
fix async
Browse files Browse the repository at this point in the history
  • Loading branch information
after-ephemera committed Feb 26, 2024
1 parent e87dbac commit a03f0b7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
28 changes: 16 additions & 12 deletions src/api/oncall/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@ export const getOncallSlackMembers = async (): Promise<OncallSlackUser[]> => {
const pdUsers: PdOncallResult[] = await pagerDuty.getOncalls(null);
const slack = new SlackApi();
for (const pdUser of pdUsers) {
const slackUser: Member = await slack.getUser(pdUser.user.email);
oncallSlackMembers.push(
new OncallSlackUser(
pdUser.user.name,
pdUser.user.email,
pdUser.user.id,
pdUser.schedule.id,
slackUser.id ?? ""
)
);
if (slackUser.name !== undefined) {
oncallSlackerNames.push(slackUser.name);
try {
const slackUser: Member = await slack.getUser(pdUser.user.email);
oncallSlackMembers.push(
new OncallSlackUser(
pdUser.user.name,
pdUser.user.email,
pdUser.user.id,
pdUser.schedule.id,
slackUser.id ?? ""
)
);
if (slackUser.name !== undefined) {
oncallSlackerNames.push(slackUser.name);
}
} catch (e) {
console.error(`Error getting slack user for ${pdUser.user.email}`);
}
}
return oncallSlackMembers;
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const app = new App({
registerListeners(app);

/** Start Bolt App */
await (async () => {
(async () => {
try {
await app.start(process.env.PORT ?? 3000);
console.log("⚡️ Bolt app is running! ⚡️");
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/* Modules */
"module": "NodeNext", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
"moduleResolution": "Nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
"baseUrl": ".", /* Specify the base directory to resolve non-relative module names. */
"paths": {
"@src*": ["./src", "src/*"],
Expand Down

0 comments on commit a03f0b7

Please sign in to comment.