Changeset

8602:9901deadc068

util.async: Fix order of statements so queue count makes more sense
author Matthew Wild <mwild1@gmail.com>
date Fri, 16 Mar 2018 17:12:09 +0000
parents 8601:ce5b16e13573
children 8603:dc5f3302a642
files util/async.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/async.lua	Fri Mar 16 17:11:23 2018 +0000
+++ b/util/async.lua	Fri Mar 16 17:12:09 2018 +0000
@@ -108,8 +108,8 @@
 -- Add a task item for the runner to process
 function runner_mt:run(input)
 	if input ~= nil then
+		table.insert(self.queue, input);
 		self:log("debug", "queued new work item, %d items queued", #self.queue);
-		table.insert(self.queue, input);
 	end
 	if self.state ~= "ready" then
 		-- The runner is busy. Indicate that the task item has been
@@ -176,6 +176,7 @@
 -- Add a task item to the queue without invoking the runner, even if it is idle
 function runner_mt:enqueue(input)
 	table.insert(self.queue, input);
+	self:log("debug", "queued new work item, %d items queued", #self.queue);
 end
 
 function runner_mt:log(level, fmt, ...)