refector: 优化event_push

This commit is contained in:
caoqianming 2023-09-07 12:17:07 +08:00
parent fd6b5b5db7
commit b0455d9e13
1 changed files with 5 additions and 1 deletions

View File

@ -24,6 +24,7 @@ from datetime import datetime
import uuid import uuid
from apps.ecm.serializers import EventSerializer from apps.ecm.serializers import EventSerializer
from django.utils import timezone from django.utils import timezone
from django.core.exceptions import ObjectDoesNotExist
@shared_task(base=CustomTask) @shared_task(base=CustomTask)
def store_img(code: str, duration: int): def store_img(code: str, duration: int):
@ -202,7 +203,10 @@ def remind_push(remindId: str):
@shared_task(base=CustomTask) @shared_task(base=CustomTask)
def event_push(eventId: str): def event_push(eventId: str):
event = Event.objects.get(id=eventId) try:
event = Event.objects.get(id=eventId)
except ObjectDoesNotExist:
return
if event.handle_time is None: if event.handle_time is None:
now = timezone.now() now = timezone.now()
channel_layer = get_channel_layer() channel_layer = get_channel_layer()