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

feat: 私有化部署 --story=119894675 #455

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
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
16 changes: 0 additions & 16 deletions src/backend/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ def update(self, **kwargs):
重写ORM 更新方法
"""

# 后台任务不处理
if is_backend():
return super().update(**kwargs)

# 是否跳过更新时间或更新人,某些特殊场景下使用
if kwargs.pop("skip_update_time", False):
kwargs.pop("updated_at", None)
Expand Down Expand Up @@ -92,10 +88,6 @@ def get_queryset(self):
def create(self, *args, **kwargs):
"""创建数据 自动填写通用字段"""

# 后台任务不处理
if is_backend():
return super().create(*args, **kwargs)

kwargs.update(
{
"created_at": kwargs.get("created_at") or timezone.now(),
Expand All @@ -109,10 +101,6 @@ def create(self, *args, **kwargs):
def bulk_create(self, objs, *args, **kwargs):
"""创建数据 自动填写通用字段"""

# 后台任务不处理
if is_backend():
return super().bulk_create(objs, *args, **kwargs)

for obj in objs:
obj.created_at = obj.created_at or timezone.now()
obj.created_by = obj.created_by or get_request_username()
Expand All @@ -123,10 +111,6 @@ def bulk_create(self, objs, *args, **kwargs):
def bulk_update(self, objs, *args, **kwargs):
"""更新数据 自动填写通用字段"""

# 后台任务不处理
if is_backend():
return super().bulk_update(objs, *args, **kwargs)

for obj in objs:
obj.created_at = obj.created_at or timezone.now()
obj.created_by = obj.created_by or get_request_username()
Expand Down
8 changes: 8 additions & 0 deletions src/backend/services/web/entry/init/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
CreateRedisRequestSerializer,
StorageCreateRequestSerializer,
)
from services.web.databus.tasks import create_or_update_plugin_etl
from services.web.entry.constants import (
INIT_ES_FISHED_KEY,
INIT_FIELDS_FINISHED_KEY,
Expand Down Expand Up @@ -80,6 +81,7 @@ def init(self):
self.init_redis()
self.init_snapshot()
self.init_event()
self.create_or_update_plugin_etl()
print("[Main] Init Finished")

def pre_init(self):
Expand Down Expand Up @@ -158,3 +160,9 @@ def init_event(self):
print("[InitEvent] Start")
EventHandler().update_or_create_rt()
print("[InitEvent] Stop")

def create_or_update_plugin_etl(self):
"""创建或更新采集入库"""
print("[CreateOrUpdatePluginEtl] Start")
create_or_update_plugin_etl()
print("[CreateOrUpdatePluginEtl] Stop")
Loading