Closed chaklasiyanikunj closed 4 years ago
Execution timeouts are often due to a rendezvous timing out. You want to do whatever you can to minimize the number of rendezvous your code is making. There's more information about that here: https://developer.roku.com/docs/developer-program/core-concepts/threads.md#task-node-thread-rendezvous-timeout
Another good practice is to avoid unnecessary use of the m variable within a ContentHandler. Use local variables whenever possible.
Thank you for your great answer and suggestion.
I removed all global variables in the Task node. Roku Device No More Restart. But, I have created one JSON file in the server. Inside a JSON File around 32000 lines. The file size is 800KB. I check with this API using the postman tool. With the Local Server My Response times around 120ms. And With Global Server(It means Region Difference) My Response times around 1100ms. Now, I used Below Function in Roku.
sub FetchContent()
rxfer = CreateObject("roUrlTransfer")
m.tempArray = CreateObject("roArray", 0, true)
url = "MyAPIURL"
?"url : "url
rxfer.SetUrl(url)
?"raw Start"
raw = rxfer.GetToString() 'This lines It's take too much time
?"raw End"
json = ParseJson(raw)
rows = {
children: []
}
for each row in json
rowNode = {}
if row.title <> invalid and row.title <> ""
rowNode.title = row.title
else
rowNode.title = "---"
end if
rows.children.Push(rowNode)
m.tempArray.Push(rowNode)
end for
m.global.rowNode = m.tempArray
end sub
My Internet Speed is around 250mbps. When I Application launched these lines raw = rxfer.GetToString()
takes to Average 5-10 mins Every times. Why does it take so long? Anything I'm doing wrong? and Currently, I am not set 0 in port. But how much times take when I set 0 in port like below. msg = Wait(0, m.port)
I tried to API call using below logic inside a Task node.
I test using the Postman tool My File Response takes around 800ms. I applied different below logic and the Results inside a Task node For fetch response from API.
'First Logic
'When I performed the First logic. Results are below :
When the Application launch :
'Second Logic
'When I performed the Second logic. Results are below :
When the Application launch :
Third Logic (Using Internal File):
'When I performed the Third logic. Results are below :
When the Application launch :
I don't understand one thing. It's giving a Execution timeout error. It's ok but why Roku Device restart's the Automatic. Any Solution available for this thing?