Need to know about the SMI working

Hi,
We know that the SMI needs to be executed within 5 secs. We have noticed that even though the app called the renderData function at the very beginning of the SMI, it doesn’t return the data to the frontend. The app keeps waiting until the SMI functionality gets completed. If it takes more than 5 secs to excute the serverless function even if renderData called initially, the timeout error occured. In this case, does the SMI script stops executing after 5 secs? I have attached an image below for your reference. In the attached image, Do I need to remove the keyword await for non blocking nature so that will the app not face the timeout error and keeps executing even after 5 secs?

Hi Sheik,
The renderData method should be the called as the last line of an SMI method. Any code written after renderData have unexpected behaviour. Hope this clarifies the issue. You can also keep an explicit return statement immediately after renderData as well to ensure method is immediately returned.

Hi @ManiDeepak_Vandrangi,
Thank for your quick response. We know that the renderData in SMI is used for sending the data from the backend to the frontend. We have a scenario like when a user clicks a button, the app should complete a task. In this case, the user need not to be wait for the task to get completed. So we have called the renderData at the very beginning of the SMI function, the script will be excuted in an async manner. But we observed that the data is not sent to the client until the SMI function completes its execution, resulted in an unexpected behaviour.

Sometimes SMI function takes more than 5 secs to complete its execution. If it takes more than 5 secs, the client will receive an error like 504 error. We could see that the app not able to complete the task when it’s execution time exceeds 5 secs. Can SMI function be executed even after 5 secs?

Hi Sheik,
SMI is not supposed to execute beyond 5 seconds considering UI is awaiting the result. You can schedule a task from SMI. Scheduled events have a higher timeout ( 20 seconds ).