Skip to content

Commit

Permalink
fix(sqlserver): sqlserver 手动重试、迁移记录时区问题 #6668
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 17394
  • Loading branch information
ygcyao authored and iSecloud committed Sep 4, 2024
1 parent 4104172 commit b32c403
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dbm-ui/backend/db_meta/models/sqlserver_dts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from django.db import models
from django.db.models import Q
from django.utils.timezone import localtime
from django.utils.translation import ugettext_lazy as _

from backend.bk_web.models import AuditedModel
Expand Down Expand Up @@ -80,7 +81,8 @@ def to_dict(self):
for f in opts.concrete_fields:
value = f.value_from_object(self)
if isinstance(value, datetime):
value = value.strftime("%Y-%m-%d %H:%M:%S")
# value = value.strftime("%Y-%m-%d %H:%M:%S")
value = localtime(value).isoformat(timespec="seconds")
elif isinstance(f, models.FileField):
value = value.url if value else None
data[f.name] = value
Expand Down
3 changes: 2 additions & 1 deletion dbm-ui/backend/ticket/builders/sqlserver/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
fetch_cluster_ids,
)
from backend.ticket.builders.mysql.base import MySQLClustersTakeDownDetailsSerializer
from backend.ticket.constants import TicketType
from backend.ticket.constants import FlowRetryType, TicketType


class BaseSQLServerTicketFlowBuilder(SQLServerTicketFlowBuilderPatchMixin, TicketFlowBuilder):
group = DBType.Sqlserver.value
retry_type = FlowRetryType.MANUAL_RETRY


class SQLServerBasePauseParamBuilder(builders.PauseParamBuilder):
Expand Down
1 change: 1 addition & 0 deletions dbm-ui/backend/ticket/flow_manager/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def flush_error_status_handler(self):
def flush_revoke_status_handler(self, operator):
"""终止节点,更新相关状态和错误信息"""
self.flow_obj.status = TicketFlowStatus.TERMINATED
self.flow_obj.err_code = FlowErrCode.GENERAL_ERROR
if operator == DEFAULT_SYSTEM_USER:
self.flow_obj.err_code = FlowErrCode.SYSTEM_TERMINATED_ERROR
self.flow_obj.context = {FlowContext.EXPIRE_TIME: self.get_current_config_expire_time()}
Expand Down

0 comments on commit b32c403

Please sign in to comment.