Comparison

util/async.lua @ 8976:92f0876b9230

MUC: Add config option to allow members to invite other members to the room (previously only owners/admins could do this)
author Matthew Wild <mwild1@gmail.com>
date Fri, 06 Jul 2018 15:33:46 +0100
parent 8927:ed0891383e78
child 8995:2e6f7ab97794
comparison
equal deleted inserted replaced
8975:47dd2e850781 8976:92f0876b9230
146 146
147 -- Add a task item for the runner to process 147 -- Add a task item for the runner to process
148 function runner_mt:run(input) 148 function runner_mt:run(input)
149 if input ~= nil then 149 if input ~= nil then
150 table.insert(self.queue, input); 150 table.insert(self.queue, input);
151 self:log("debug", "queued new work item, %d items queued", #self.queue); 151 --self:log("debug", "queued new work item, %d items queued", #self.queue);
152 end 152 end
153 if self.state ~= "ready" then 153 if self.state ~= "ready" then
154 -- The runner is busy. Indicate that the task item has been 154 -- The runner is busy. Indicate that the task item has been
155 -- queued, and return information about the current runner state 155 -- queued, and return information about the current runner state
156 return true, self.state, #self.queue; 156 return true, self.state, #self.queue;
165 end 165 end
166 166
167 -- Process task item(s) while the queue is not empty, and we're not blocked 167 -- Process task item(s) while the queue is not empty, and we're not blocked
168 local n, state, err = #q, self.state, nil; 168 local n, state, err = #q, self.state, nil;
169 self.state = "running"; 169 self.state = "running";
170 self:log("debug", "running main loop"); 170 --self:log("debug", "running main loop");
171 while n > 0 and state == "ready" and not err do 171 while n > 0 and state == "ready" and not err do
172 local consumed; 172 local consumed;
173 -- Loop through queue items, and attempt to run them 173 -- Loop through queue items, and attempt to run them
174 for i = 1,n do 174 for i = 1,n do
175 local queued_input = q[i]; 175 local queued_input = q[i];