Просмотр исходного кода

set timeout to checkCommunicableToApiServer

Yuki Takei 4 лет назад
Родитель
Сommit
5ea04aa0d3
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      packages/slack/src/utils/check-communicable-to-api-server.ts

+ 7 - 1
packages/slack/src/utils/check-communicable-to-api-server.ts

@@ -1,8 +1,14 @@
 import axios, { AxiosError } from 'axios';
 
+/**
+ * Check whether the HTML server responds or not.
+ *
+ * @param serverUri Server URI to connect
+ * @returns AxiosError when error is occured
+ */
 export const checkCommunicableToApiServer = async(serverUri = 'https://slack.com/api/'): Promise<void|AxiosError> => {
   try {
-    await axios.get(serverUri, { maxRedirects: 0 });
+    await axios.get(serverUri, { maxRedirects: 0, timeout: 3000 });
   }
   catch (err) {
     return err as AxiosError;