-
Notifications
You must be signed in to change notification settings - Fork 55
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(platform): api service change to stateless #140
Conversation
|
||
type Registry struct { | ||
agentCache *cache.Cache | ||
rdb redis.UniversalClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rdb 似乎没有用到
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
仔细看了一段时间,感觉这里定义是重复的?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已删除无用代码
continue | ||
} | ||
case *redis.Client: | ||
err := r.scanServiceKeysAndUpdate(rdb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
扫全表 redis,一般 redis 的运维会禁用这个操作
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 这里需要调整实现.
- 另外这里实现的注册和发现都是给 API 用的嘛.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已更改redis的更新方式,
通过监控一个hash key和一个redis channel实现
@@ -47,6 +47,8 @@ type ConsistentHashDispatcher struct { | |||
hasher *consistent.Consistent | |||
Tasks map[string]*model.Task | |||
ServiceWithTasks map[string]map[string]*model.Task | |||
|
|||
IdlIdToTaskIdMap map[int64]string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里添加这个map的作用是什么
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前想通过 idl id 删除 task,只有加这个map才能实现
"github.com/redis/go-redis/v9" | ||
) | ||
|
||
func NewRedisRegistry(rdb redis.UniversalClient) *redisregistry.Registry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
builin 和 redis 的实现区别,目前看没区别
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
builtin是只将 agent 服务信息存储在内存,redis是将 agent 服务信息保存在redis中
ba490d2
to
3d106a2
Compare
344611e
to
3f54952
Compare
3f54952
to
2f04e17
Compare
What type of PR is this?
feat
What this PR does / why we need it (en: English/zh: Chinese):
en: api service change to stateless
zh: 将 api 服务变成无状态的
进行的改动:
Which issue(s) this PR fixes:
#136