[Sugar-devel] [sugar-html-core] Some questions regarding the bus.js API.

Daniel Narvaez dwnarvaez at gmail.com
Sat May 18 02:30:27 EDT 2013


Good catch. By design ordering should be preserved, so this needs fixing.

On Saturday, 18 May 2013, Aneesh Dogra wrote:

> Hello list,
>
> I was just looking over some code in bus.js and I noticed that we are
> actually using a stack to prioritize and keep track of our send requests.
> The array which you name as "queue" is actually used as a stack.
>
> Here's what I think is happening:
>
> Suppose I send 3 consecutive requests:
>
> The script adds them in the "queue" variable as: [1, 2, 3]
>
> but in start we are doing:
>
>            while (queue.length > 0) {
>                 socket.send(queue.pop());
>             }
>
> so, we send the requests in order:
> 3, 2, 1
>
> Hence, the last request made later gets the first priority.
> Is this intended by design?
> --
> Thanks
> Aneesh Dogra (lionaneesh)
>


-- 
Daniel Narvaez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130518/7142bf76/attachment.html>


More information about the Sugar-devel mailing list