perf: The command amount does not record operation logs

This commit is contained in:
jiangweidong
2024-12-20 11:13:10 +08:00
committed by Bryan
parent 8bedef92f0
commit 94e08f3d96
5 changed files with 9 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ from django.core.cache import cache
from django.db import models
from django.utils.translation import gettext_lazy as _
from common.const.signals import SKIP_SIGNAL
from common.const.signals import OP_LOG_SKIP_SIGNAL
from common.db.models import JMSBaseModel
from common.utils import get_logger, lazyproperty
from orgs.utils import tmp_to_root_org
@@ -152,7 +152,7 @@ class Terminal(StorageMixin, TerminalStatusMixin, JMSBaseModel):
def delete(self, using=None, keep_parents=False):
if self.user:
setattr(self.user, SKIP_SIGNAL, True)
setattr(self.user, OP_LOG_SKIP_SIGNAL, True)
self.user.delete()
self.name = self.name + '_' + uuid.uuid4().hex[:8]
self.user = None

View File

@@ -12,6 +12,7 @@ from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from assets.models import Asset
from common.const import OP_LOG_SKIP_SIGNAL
from common.utils import get_object_or_none, lazyproperty
from orgs.mixins.models import OrgModelMixin
from terminal.backends import get_multi_command_storage
@@ -203,6 +204,7 @@ class Session(OrgModelMixin):
if self.need_update_cmd_amount:
cmd_amount = self.compute_command_amount()
self.cmd_amount = cmd_amount
setattr(self, OP_LOG_SKIP_SIGNAL, True)
self.save()
elif self.need_compute_cmd_amount:
cmd_amount = self.compute_command_amount()