-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Functions in que are processed before functions in cmd #11906
Comments
As an aside, the chromium team is recommending async processing of these |
What scenario do you have in mind? I can't think of any way to be sure of how your commands will line up if you're setting them up from a 3rd party script - even if you had just one queue.
I agree they are redundant - but I am not sure about getting rid of one as it'd be asking users to potentially do a lot of work for very little gain.
Reasonable, but again at this point it's more likely to create problems than to be an improvement. |
Is more about the un-reliability and lack of knowledge. If you understand how it works, there are ways around it.
So, will get two results, with same code, just depending when the files are loaded. I do not think is really a bug, more the lack of knowledge on how this works. Probably this is encountered on complex implementations from companies with resources to troubleshoot it, so I do not think any change is needed but maybe is good just to have the issue here to be found, just in case.
I agree is little to gain. This is the situation now and this is how it works. Changing it will probably introduce a lot of problems. |
Type of issue
unexpected behavior / questions
Description
The function queued using
pbjs.que
are processed before functions queued withpbjs.cmd
before prebid library is loadedSteps to reproduce
Queue any function (even a console log) with
pbjs.que
andpbjs.cmd
and observe the execution order.Test page
https://jsfiddle.net/bozghiyy/2ndgv504/
Expected results
The function to execute in the order that they are queued.
Actual results
Function queued with

pbjs.que
are processed first until prebid library is loaded and all the queues are processed. After that functions are processed in the order that are queued.Platform details
All. Independent of platform.
Other information
Probably is due https://github.com/prebid/Prebid.js/blob/master/src/prebid.js#L981-L982, processing first
que
and thencmd
.It can cause issues when trying to run some prebid commands from a 3rd party script, the order or execution is unknown since is a race condition between prebid library and the 3rd party script. If you are aware how they work, it can be mitigated.
I do not know if I would consider this a bug and if anything needs to be "fixed", I wanted just to know an opinion if this is the intended way.
My questions would be:
que
andcmd
? (maybe one should be removed in a major release)cmd
be first? (alphabetically and is the preferred method)The text was updated successfully, but these errors were encountered: