mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 17:40:56 +00:00
Merge pull request #4306 from AllenX2018/fix-issue-4305
fix issue #4305: add write lock for map adminTaskList iteration and modify
This commit is contained in:
commit
8f16098508
@ -452,9 +452,11 @@ func (m *taskManager) StartTask() {
|
||||
|
||||
func (m *taskManager) run() {
|
||||
now := time.Now().Local()
|
||||
m.taskLock.Lock()
|
||||
for _, t := range m.adminTaskList {
|
||||
t.SetNext(nil, now)
|
||||
}
|
||||
m.taskLock.Unlock()
|
||||
|
||||
for {
|
||||
// we only use RLock here because NewMapSorter copy the reference, do not change any thing
|
||||
|
Loading…
Reference in New Issue
Block a user