Skip to content

Commit

Permalink
🐛 time.After memory leak before go1.23 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
akkuman committed Aug 9, 2024
1 parent 4025d00 commit 80cec26
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sync_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ func (repo *Repo) tryLockCloud(currentDeviceID string, context map[string]interf

// 锁定成功,定时刷新锁
go func() {
ticker := time.NewTicker(30 * time.Second)
defer ticker.Stop()
for {
select {
case <-endRefreshLock:
return
case <-time.After(30 * time.Second):
case <-ticker.C:
if refershErr := repo.lockCloud0(currentDeviceID); nil != refershErr {
logging.LogErrorf("refresh cloud repo lock failed: %s", refershErr)
}
Expand Down

0 comments on commit 80cec26

Please sign in to comment.