瀏覽代碼

增加方法

wangchuanjin 2 年之前
父節點
當前提交
733b011de4
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      p/public.go

+ 4 - 4
p/public.go

@@ -727,13 +727,13 @@ func TimesIsOver(times []string, hour int) (bool, time.Time, time.Time) {
 }
 
 //监听超时
-func MonitorTimeOut(pool chan bool, timeoutWarn string, f func()) bool {
+func MonitorTimeOut(pool chan bool, timeout time.Duration, warn string, f func()) bool {
 	select {
-	case <-time.After(1 * time.Minute):
+	case <-time.After(timeout):
 		go func() {
 			f()
-			if timeoutWarn != "" {
-				if _, err := http.Get(timeoutWarn); err != nil {
+			if warn != "" {
+				if _, err := http.Get(warn); err != nil {
 					logger.Error("发送告警邮件错误", err)
 				}
 			}