F 修复某些情况下告警未正常发出的问题

pull/462/head
vapao 2022-03-06 23:07:10 +08:00
parent 9fb2a9405f
commit c08fad5b35
2 changed files with 2 additions and 3 deletions

View File

@ -22,7 +22,7 @@ class Notify(models.Model, ModelMixin):
title = models.CharField(max_length=255)
source = models.CharField(max_length=10, choices=SOURCES)
type = models.CharField(max_length=2, choices=TYPES)
content = models.CharField(max_length=255, null=True)
content = models.TextField(null=True)
unread = models.BooleanField(default=True)
link = models.CharField(max_length=255, null=True)

View File

@ -6,7 +6,6 @@ from apps.setting.utils import AppSetting
from apps.notify.models import Notify
from libs.mail import Mail
from libs.utils import human_datetime
from threading import Thread
import requests
import json
@ -39,7 +38,7 @@ class Notification:
@staticmethod
def handle_request(url, data, mode=None):
try:
res = requests.post(url, json=data, timeout=30)
res = requests.post(url, json=data, timeout=15)
except Exception as e:
return Notify.make_system_notify('通知发送失败', f'接口调用异常: {e}')
if res.status_code != 200: