Skip to content

Commit

Permalink
fix: 修复了更新与测速缓存锁没有被正确释放的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster1963 committed Jul 27, 2023
1 parent 8c3c11f commit d0888a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions internal/boot/boot.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func bootCheck(initData *g_structs.InitData) (err error) {

err = cli_utils.CmdCore.StartSpeedCmd(context.Background(), initData)
if err != nil {
glog.Error(context.Background(), "测试测速服务", err)
return
glog.Error(context.Background(), "测试测速服务出错", err)
}

// 移除测速状态
_, _ = gcache.Remove(ctx, g_cache.SpeedCacheKey)

Expand Down Expand Up @@ -94,11 +94,14 @@ func bootMethod(initData *g_structs.InitData) (err error) {
err := update_utils.AutoUpdate.UpdateCore(ctx, initData)
if err != nil {
glog.Error(ctx, "自动更新服务失败: ", err)
return
}

// 移除更新状态
if !gcache.MustGet(ctx, g_cache.UpdateCacheKey).IsNil() {
_, _ = gcache.Remove(ctx, g_cache.UpdateCacheKey)
}

return
}, "Cron-Update")
if err != nil {
glog.Warning(ctx, "添加初始化自动更新服务失败: ", err)
Expand Down
4 changes: 2 additions & 2 deletions utility/cron_utils/cron_manage.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ func addSpeedCron(ctx context.Context, initData *g_structs.InitData, timePattern
err := cli_utils.CmdCore.StartSpeedCmd(ctx, initData)
if err != nil {
glog.Error(ctx, "定时测速服务失败: ", err)
return
}

// 移除测速状态
_, _ = gcache.Remove(ctx, g_cache.SpeedCacheKey)
return
}, "Speed-Cron")
if err != nil {
glog.Warning(ctx, "添加定时测速服务失败: ", err)
Expand Down

0 comments on commit d0888a8

Please sign in to comment.