Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: once update http rule value #1439

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions console/views/app_config/app_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import json
import logging
import re
import threading
import time

from console.constants import DomainType
from console.repositories.app import service_repo
Expand Down Expand Up @@ -545,9 +547,18 @@ def post(self, request, *args, **kwargs):
cf_dict["rule_id"] = data["http_rule_id"]
cf_dict["value"] = json.dumps(value)
configuration_repo.add_configuration(**cf_dict)

# 等待2秒去更新参数,不然首次添加的参数无法及时生效
wait_thread = threading.Thread(target=self.wait_update, args=(data["http_rule_id"], value))
wait_thread.start()

result = general_message(201, "success", "策略添加成功", bean=data)
return Response(result, status=status.HTTP_201_CREATED)

def wait_update(self, rule_id, value):
time.sleep(2)
domain_service.update_http_rule_config(self.tenant, self.response_region, rule_id, value)

# 预先检查nginx 的header 值是否正确
def check_nginx_syntax(self, config_data):
try:
Expand Down
Loading