Compare commits

...

2 Commits
v4.4 ... v4.3

Author SHA1 Message Date
ibuler
3153458fce fix: oracle platform create error 2024-10-30 16:33:42 +08:00
feng
4b981fd93c fix: Error subpub_msg log 2024-10-17 15:17:12 +08:00
2 changed files with 8 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ from collections import defaultdict
from copy import deepcopy from copy import deepcopy
from django.conf import settings from django.conf import settings
from django.utils.functional import lazy
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from common.db.models import ChoicesMixin from common.db.models import ChoicesMixin
@@ -29,15 +30,15 @@ class AllTypes(ChoicesMixin):
@classmethod @classmethod
def choices(cls): def choices(cls):
return lazy(cls.get_choices, list)()
@classmethod
def get_choices(cls):
choices = [] choices = []
for tp in cls.includes: for tp in cls.includes:
choices.extend(tp.get_choices()) choices.extend(tp.get_choices())
return choices return choices
@classmethod
def get_choices(cls):
return cls.choices()
@classmethod @classmethod
def filter_choices(cls, category): def filter_choices(cls, category):
choices = dict(cls.category_types()).get(category, cls).get_choices() choices = dict(cls.category_types()).get(category, cls).get_choices()

View File

@@ -47,7 +47,7 @@ class Subscription:
self.ch = pb.ch self.ch = pb.ch
self.sub = sub self.sub = sub
self.unsubscribed = False self.unsubscribed = False
logger.info("Subscribed to channel: ", sub) logger.info(f"Subscribed to channel: {sub}")
def _handle_msg(self, _next, error, complete): def _handle_msg(self, _next, error, complete):
""" """
@@ -106,11 +106,11 @@ class Subscription:
def unsubscribe(self): def unsubscribe(self):
self.unsubscribed = True self.unsubscribed = True
logger.info("Unsubscribed from channel: ", self.sub) logger.info(f"Unsubscribed from channel: {self.sub}")
try: try:
self.sub.close() self.sub.close()
except Exception as e: except Exception as e:
logger.warning('Unsubscribe msg error: {}'.format(e)) logger.warning(f'Unsubscribe msg error: {e}')
def retry(self, _next, error, complete): def retry(self, _next, error, complete):
logger.info('Retry subscribe channel: {}'.format(self.ch)) logger.info('Retry subscribe channel: {}'.format(self.ch))