|
@@ -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)
|
|
|
}
|
|
|
}
|