-
Notifications
You must be signed in to change notification settings - Fork 249
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: webconsole relay优化 #3593
base: master
Are you sure you want to change the base?
feat: webconsole relay优化 #3593
Conversation
return nil | ||
} | ||
|
||
timer := time.NewTicker(time.Second * 30) |
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.
不需要那么频繁List列表, 默认10分钟就好
for { | ||
select { | ||
case <-ctx.Done(): | ||
// 获取退出信号, 删除一次 |
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.
这里数据不会丢失,直接退出
|
||
folderNames, err := u.storage.ListFolders(ctx, "") | ||
if err != nil { | ||
blog.Errorf("list folders failed, err: %s", err) |
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.
错误和日志记录一个就好, 调用函数入口已经记录,可以返回fmt.Errorf("list folders: %w", err), 下同
https://tonybai.com/2024/04/14/either-return-error-or-log-them-do-not-do-both/
v = strings.Trim(v, "/") | ||
date, err := time.Parse(time.DateOnly, v) | ||
if err != nil { | ||
continue |
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.
这里如果目录不合法,效果是直接隐藏了, 直接按0值处理(相同的日志按字符串排序)
for _, v := range folderNames { | ||
v = strings.Trim(v, "/") | ||
date, err := time.Parse(dateTimeFormat, v) | ||
if err != nil { |
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.
解析错误打印warnning日志,人工处理
DataDir string `yaml:"data_dir"` // 格式如 ./data | ||
Enabled bool `yaml:"enabled"` | ||
DataDir string `yaml:"data_dir"` // 格式如 ./data | ||
ReserveDay int `yaml:"reserve_day"` |
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.
RetentionDays
@@ -185,6 +185,29 @@ func (b *bkrepoStorage) ListFolders(ctx context.Context, folderName string) ([]s | |||
return folders, nil | |||
} | |||
|
|||
// DeleteFolders delete of folders under current bkRepo folder |
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.
List 显示不全是不是没有处理
|
||
var expireFolders []string | ||
reserveDay := time.Duration(config.G.Audit.ReserveDay) | ||
if reserveDay == 0 { |
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.
0应该是不删除, 默认30天在配置文件中, 记得输出 ./bcs-webconsole -o yaml > etc/config.yaml
feat: webconsole relay优化