1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-23 18:10:54 +00:00

fix issue#4305: add write lock for map adminTaskList iteration and modify

This commit is contained in:
AllenX2018 2020-11-11 17:14:05 +08:00
parent c5c03815f3
commit aad80ba4fa

View File

@ -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