Overview
Andi skills are given 15 seconds to run before a “skill timed out” error is generated. If a skill takes longer than 15 seconds to run, any results will not be sent back to a front-end user. Additionally, each network call may have individual timeouts as well, separate from the overall 15 second skill timeout. A network call timeout can also prevent results from reaching users. It’s important to guard against timeouts when writing Andi skills. This article will cover when skill timeouts may occur and how to troubleshoot them.
In this Article
When Might Timeouts Occur?
Timeouts can occur within skills for the following reasons:
-
Network timeouts:
-
PL API timeouts/rate limits
-
External API timeouts
-
Andi API timeouts
-
-
Infinite loops within skill code
-
Multiple long-running network calls
Troubleshooting Timeout Issues
A good way to troubleshoot skills in general when the skill is installed in the testing audience is to use debug logs. See the Debug Power article for details. Using this power, a skill writer can generate timestamps before and after each API call to determine how long calls take and find any bottlenecks/potential timeouts. Debug logs can also be used to find any infinite loops or other issues that could be causing timeouts.
Skill Performance Best Practices
-
Limit skill runs to only fire on events that occur as often as you need. If an event occurs frequently, a skill and any dependent APIs may be called excessively. Avoid using “log-engine-change” and “loanRecalculated” events where possible. See List of PrecisionLender Events for more information on the different events fired from PrecisionLender.
-
Set timeouts for network calls appropriately when possible. The andi.request.get and precisionlender.api.get powers now allow a configurable timeout parameter to be set. If a call is expected to return quickly, setting a short timeout allows for retries and/or error handling. If a call is expected to take a while, make sure to set the request timeout high enough.
-
Use PrecisionLender v2 powers when possible. The v2 powers have retry capabilities built in and hit the v2 PrecisionLender endpoints. Reference PrecisionLender V2 Powers for more details.