perf: add replay_size on session

This commit is contained in:
Eric 2025-07-07 14:59:09 +08:00 committed by 老广
parent 1a1acb62de
commit 9bdfab966f
3 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.13 on 2025-07-07 06:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('terminal', '0008_endpoint_mongodb_port'),
]
operations = [
migrations.AddField(
model_name='session',
name='replay_size',
field=models.BigIntegerField(default=0, verbose_name='Replay size'),
),
]

View File

@ -50,6 +50,7 @@ class Session(OrgModelMixin):
comment = models.TextField(blank=True, null=True, verbose_name=_("Comment")) comment = models.TextField(blank=True, null=True, verbose_name=_("Comment"))
cmd_amount = models.IntegerField(default=-1, verbose_name=_("Command amount")) cmd_amount = models.IntegerField(default=-1, verbose_name=_("Command amount"))
error_reason = models.CharField(max_length=128, blank=True, verbose_name=_("Error reason")) error_reason = models.CharField(max_length=128, blank=True, verbose_name=_("Error reason"))
replay_size = models.BigIntegerField(default=0, verbose_name=_("Replay size"))
upload_to = 'replay' upload_to = 'replay'
ACTIVE_CACHE_KEY_PREFIX = 'SESSION_ACTIVE_{}' ACTIVE_CACHE_KEY_PREFIX = 'SESSION_ACTIVE_{}'

View File

@ -48,7 +48,7 @@ class SessionSerializer(BulkOrgResourceModelSerializer):
"protocol", 'type', "login_from", "remote_addr", "protocol", 'type', "login_from", "remote_addr",
"is_success", "is_finished", "has_replay", "has_command", "is_success", "is_finished", "has_replay", "has_command",
"date_start", "date_end", "duration", "comment", "terminal_display", "is_locked", "date_start", "date_end", "duration", "comment", "terminal_display", "is_locked",
'command_amount', 'error_reason' 'command_amount', 'error_reason', 'replay_size',
] ]
fields_fk = ["terminal", ] fields_fk = ["terminal", ]
fields_custom = ["can_replay", "can_join", "can_terminate"] fields_custom = ["can_replay", "can_join", "can_terminate"]