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: webconsole relay优化 #3593

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LidolLxf
Copy link
Contributor

feat: webconsole relay优化

return nil
}

timer := time.NewTicker(time.Second * 30)
Copy link
Member

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():
// 获取退出信号, 删除一次
Copy link
Member

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)
Copy link
Member

@ifooth ifooth Oct 25, 2024

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
Copy link
Member

@ifooth ifooth Oct 25, 2024

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 {
Copy link
Member

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"`
Copy link
Member

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
Copy link
Member

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 {
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants