Multiple AdRequests are executed 1 by 1

93 views
Skip to first unread message

Petro Pokydko

unread,
Mar 27, 2024, 5:09:36 AMMar 27
to Interactive Media Ads SDK
Hello team,

I have a question and may be you will have suggestion :)

According to documentation multiple ads should be fetched asynchronously, but in Dev Tools I do see a waterfall (see attached screenshot), while AdsLoader.requestAds is called 3 times in a row with 0.001s diff.

So the question is:
How do I make it parallel, executed X at the same time and not in a sequence?

Thanks
Petro
Screenshot 2024-03-25 221956.png

IMA SDK

unread,
Mar 27, 2024, 11:50:24 AMMar 27
to petro....@gmail.com, ima...@googlegroups.com

Hi,

Thank you for reaching out to the IMA SDK support team. 

Could you please provide the VAST details so that we can replicate the issue in our environment?

This message is in relation to case "ref:!00D1U01174p.!5004Q02s0Gsp:ref" (ADR-00228879)

Thanks,
 
Google Logo IMA SDK Team

 



Petro Pokydko

unread,
Mar 28, 2024, 12:12:32 AMMar 28
to Interactive Media Ads SDK
Thanks for a quick reply.
Could you please close duplicate thread I have opened before.

I have prepared quick sample here: https://codepen.io/ppokyd/pen/YzMxewg
Please check Dev Tools > Network tab, you can easily see that tags are being requested 1 by 1

Thanks
Screenshot 2024-03-27 182621.png

IMA SDK

unread,
Mar 28, 2024, 10:58:18 AMMar 28
to petro....@gmail.com, ima...@googlegroups.com
Hi,

Thank you for providing test portal.

In the context provided, the term "asynchronous" does not pertain to the request/response time differential of 0.001 seconds.

While the request times appear comparable, the response times may vary. Consequently, if tasks A, B, and C are being executed concurrently, the order in which the responses are received is not predetermined. The responses could be received in the following sequences: Response B, A, and C or Response A, C, and B. The getUserRequestContext characteristic is used for that calculation. This enables iteration to derive the appropriate response.


// Request
const contextA = {id: "Request A", element: videoElementA};
const contextB = {id: "Request B", element: videoElementB}
adsLoader.requestAds(adsRequestA, contextA);
adsLoader.requestAds(adsRequestB, contextB)

// Response
  const context = adsManagerLoadedEvent.getUserRequestContext();
  adsManager = adsManagerLoadedEvent.getAdsManager(context.element);
  console.log("Successfully loaded ID: " + context.id);

Above code is to identify the incoming async context.

Please get back to us if you need any other help related to IMA SDK.

Petro Pokydko

unread,
Apr 1, 2024, 2:03:28 AMApr 1
to Interactive Media Ads SDK
As far as I saw, ima sdk posts a message to a bridge, which then takes messages in order the have been posted.
Basically it works like: message1 then message2 then messageN
order always keeps the same in a way they were requested

and the problem is that if I have to request 10 tags and make sure all were executed I will need to wait for 10 * time per request
due to the way bridge handles messages and I am wondering how to make it process all messages at once
Promise.all instead of Promise1.then(Promise2.then(PromiseN.then))

Thanks

IMA SDK

unread,
Apr 1, 2024, 3:58:13 PMApr 1
to petro....@gmail.com, ima...@googlegroups.com
Hi,

It is a deliberate action intended for edge case implementations, such as preloading advertisement data before the user selects a video.

Bridge communication relies upon the entire advertisement request. It is not the case that if it is put as multiple, then the expectation would be to send all data in a single call. However, you can use a handler in response by matching IDs as well, suggesting that you make a completion-free call and apply all logic in responses.

If you encounter any problems handling this edge case, you can send us the sample project, and we will analyze it and provide you with the corresponding solution code snippets.

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to

https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=IMA+SDK&entry.460850823=5004Q00002s0GspQAE&entry.80707362=00228879

2. Fill out all fields, and attach your file(s).

3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link.
Reply all
Reply to author
Forward
0 new messages