Open bozghiyy opened 6 days ago
As an aside, the chromium team is recommending async processing of these
https://github.com/prebid/Prebid.js/issues/10062#issuecomment-1798592536
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.
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.
We will always have cross-compatibility for que and cmd? (maybe one should be removed in a major release)
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.
If there is a priority in execution process queue, shouldn't cmd be first? (alphabetically and is the preferred method)
Reasonable, but again at this point it's more likely to create problems than to be an improvement.
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)