util/async.lua
changeset 8605 9901deadc068
parent 8604 ce5b16e13573
child 8606 dc5f3302a642
--- 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, ...)