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