Archived
1
0

Fix old tasks are kept in main queue and added debug output for tasks count that will be pushed back to main tasks queue.

This commit is contained in:
Stanislav Nikitin 2019-05-18 19:10:18 +05:00
parent e9d896427c
commit 1839a73717
No known key found for this signature in database
GPG Key ID: 106900B32F8192EE

View File

@ -140,6 +140,7 @@ func startReally() {
// queue, clear it and re-add if queue items still be there. // queue, clear it and re-add if queue items still be there.
tasksQueue := make([]*Task, 0, tasksCount) tasksQueue := make([]*Task, 0, tasksCount)
tasksQueue = append(tasksQueue, tasks...) tasksQueue = append(tasksQueue, tasks...)
tasks = make([]*Task, 0, 64)
tasksMutex.Unlock() tasksMutex.Unlock()
// Get tasks list to launch. // Get tasks list to launch.
@ -151,6 +152,7 @@ func startReally() {
} }
// Remove tasks that will be launched now. // Remove tasks that will be launched now.
tasksQueue = tasksQueue[tasksToRunCount:] tasksQueue = tasksQueue[tasksToRunCount:]
log.Println("Tasks count that will be returned to main queue:", len(tasksQueue))
// Re-add remaining tasks to queue. // Re-add remaining tasks to queue.
// Note: if another task was added to queue while we compose // Note: if another task was added to queue while we compose
// our tasks list to launch - it will be executed BEFORE remaining // our tasks list to launch - it will be executed BEFORE remaining