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

[Sync task] a task will be added when the configuration is added or modified successfully #227

Closed
wants to merge 2 commits into from

Conversation

robotLJW
Copy link
Member

@robotLJW robotLJW commented Nov 21, 2021

Issue: #226


简单说明:

  1. 之前操作错误,将一个commit直接强推到主库了,12f8575
  2. 当在yaml中开启同步后,已经可以完成创建配置和更新配置后同步任务的创建。

注意:开启同步后mongo需要配置副本集,单机不能进行事务操作,需要开启副本集


具体逻辑介绍

// Task is db struct to store sync task
type Task struct {
	Action    string      `json:"action" bson:"action"`
	DataType  string      `json:"data_type" bson:"data_type"`
	Data      interface{} `json:"data" bson:"data"`
	Timestamp string      `json:"timestamp" bson:"timestamp"`
	Status    string      `json:"status" bson:"status"`
}

1.当在yaml中开启同步开关 syncEnabled: false
2.创建配置或更新配置请求进入kv_svc业务中,会判断开关有没有开,如果开启后,会去调用createWithTask或updateWithTask
3.createWithTask和updateWithTask 业务处理逻辑中已经开启事务


验证

  1. db为 etcd
    1.请求创建配置
    image
    2.在db中查询配置和任务数据
    image
    image
    3.更新配置
    image
    4.在db中查询更新任务
    image
    image

2.db为 mongo
1.请求创建配置
image
2.在 db 中查询配置和任务数据
image
image
3.更新配置
image
4.在 db 中查询更新任务
image

…synchronization is turned on

     A task will be added when the configuration is added or modified successfully
@robotLJW robotLJW added the enhancement New feature or request label Nov 21, 2021
@robotLJW robotLJW changed the title Feature: Adding, deleting and modifying operations to add tasks when … [sync task] a task will be added when the configuration is added or modified successfully Nov 21, 2021
@robotLJW robotLJW changed the title [sync task] a task will be added when the configuration is added or modified successfully [Sync task] a task will be added when the configuration is added or modified successfully Nov 21, 2021
@robotLJW robotLJW linked an issue Nov 21, 2021 that may be closed by this pull request
@robotLJW robotLJW closed this Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sync task
1 participant