Skip to content

Commit

Permalink
DDL工单结束后清空实例资源缓存,修改需求链接长度
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyo committed Dec 1, 2019
1 parent 8b40615 commit 0daac43
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sql/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def schemasync(request):
return HttpResponse(json.dumps(result), content_type='application/json')


@cache_page(60 * 5)
@cache_page(60 * 5, key_prefix="insRes")
def instance_resource(request):
"""
获取实例内的资源信息,database、schema、table、column
Expand Down
2 changes: 1 addition & 1 deletion sql/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class SqlWorkflow(models.Model):
存放各个SQL上线工单的基础内容
"""
workflow_name = models.CharField('工单内容', max_length=50)
demand_url = models.CharField('需求链接', max_length=200)
demand_url = models.CharField('需求链接', max_length=500)
group_id = models.IntegerField('组ID')
group_name = models.CharField('组名称', max_length=100)
instance = models.ForeignKey(Instance, on_delete=models.CASCADE)
Expand Down
7 changes: 7 additions & 0 deletions sql/utils/execute_sql.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: UTF-8 -*-

from django_redis import get_redis_connection
from common.utils.const import WorkflowDict
from sql.engines.models import ReviewResult, ReviewSet
from sql.models import SqlWorkflow
Expand Down Expand Up @@ -69,5 +70,11 @@ def execute_callback(task):
operator_display='系统'
)

# DDL工单结束后清空实例资源缓存
if workflow.syntax_type == 1:
r = get_redis_connection("default")
for key in r.scan_iter(match='*insRes*', count=2000):
r.delete(key)

# 发送消息
notify_for_execute(workflow)
2 changes: 1 addition & 1 deletion src/init_sql/v1.7.2_v1.7.3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
UPDATE auth_permission SET codename='menu_tools' WHERE codename='menu_menu_tools';

-- SQL上线工单增加需求链接
ALTER TABLE sql_workflow ADD demand_url varchar(500) NOT NULL DEFAULT '' COMMENT '需求链接';
ALTER TABLE sql_workflow ADD demand_url varchar(500) NOT NULL DEFAULT '' COMMENT '需求链接';

0 comments on commit 0daac43

Please sign in to comment.