Răsfoiți Sursa

set timeout to checkCommunicableToApiServer

Yuki Takei 4 ani în urmă
părinte
comite
5ea04aa0d3

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

@@ -1,8 +1,14 @@
 import axios, { AxiosError } from 'axios';
 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> => {
 export const checkCommunicableToApiServer = async(serverUri = 'https://slack.com/api/'): Promise<void|AxiosError> => {
   try {
   try {
-    await axios.get(serverUri, { maxRedirects: 0 });
+    await axios.get(serverUri, { maxRedirects: 0, timeout: 3000 });
   }
   }
   catch (err) {
   catch (err) {
     return err as AxiosError;
     return err as AxiosError;