Browse Source

增加方法

wangchuanjin 2 năm trước cách đây
mục cha
commit
733b011de4
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  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)
 				}
 			}