From 6e0125c5c304aa6af89df4df0fbd0f1fbcb40c23 Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Wed, 27 Sep 2023 17:58:25 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20slack=20web=20hook=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B8=EB=93=A4=EB=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/notificateToSlack.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/hooks/notificateToSlack.ts b/src/hooks/notificateToSlack.ts index e5c241a1..264a4c65 100644 --- a/src/hooks/notificateToSlack.ts +++ b/src/hooks/notificateToSlack.ts @@ -6,12 +6,16 @@ const notificationToSlack = async (text: string): Promise => { console.error(text); return; } - await axios.post(env.SLACK_WEBHOOK_URL, { - Headers: { - 'Content-type': 'application/json', - }, - text, - }); + try { + await axios.post(env.SLACK_WEBHOOK_URL, { + Headers: { + 'Content-type': 'application/json', + }, + text, + }); + } catch (error) { + console.error(error); + } return; }; From 77eea658044262f254ab63a3c623f1b2b5ecf0a8 Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Thu, 28 Sep 2023 15:22:12 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Fix:=20=EC=95=8C=EB=A6=BC=EC=9D=84=20?= =?UTF-8?q?=EB=B3=B4=EB=82=BC=20=EB=82=B4=EC=9A=A9=EC=9D=B4=20=EC=97=86?= =?UTF-8?q?=EB=8A=94=EA=B2=BD=EC=9A=B0=20=EC=8A=AC=EB=9E=99=20=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=EC=9D=84=20=EC=95=88=EB=B3=B4=EB=82=B4=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/cronNoticeCrawling.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/cronNoticeCrawling.ts b/src/hooks/cronNoticeCrawling.ts index 6f41a1d6..f679d9b1 100644 --- a/src/hooks/cronNoticeCrawling.ts +++ b/src/hooks/cronNoticeCrawling.ts @@ -13,7 +13,7 @@ const pushToUsers = async (majors: string[]) => { const count = await pushNotification(major); pushedUserCount += `${major} ${count}명 알림 완료\n`; } - notificationToSlack(pushedUserCount); + if (pushedUserCount.length !== 0) notificationToSlack(pushedUserCount); }; cron.schedule('0 0-9 * * 1-5', async () => {