Hello folks, I am working on a Forge app that does asset imports into the JSM Assets platform. The app fetches CMDB data from a 3rd party product API and syncs it with Assets in JSM.
I am using Imports REST API for schema creation and asset sync process. I am using the Atlassian forge framework for the same. For schema creation, we create 1 object type having 20 attributes in a single API call. We are using /mapping
endpoint for the same. 6 of the attributes are of type referenced_object
.
I am not doing any concurrent calls to this endpoint and the app waits for the API response every time.
The issue is in Forge each function should complete its execution in 25 sec. but the schema creation endpoint sometimes starts getting timed out after some successful schema creation API calls.
Our functions have a time limit of 25 seconds, so If an API call’s response takes more than 24 seconds, then we terminate the function and do a retry. Such retries are done 4 times.
In this case, we are not waiting for a response, so it can be the case that the next API call is done before receiving the response from another. But this is something that is out of our control as we get a limit of 25 seconds for function invocation from Forge.
I also kept the retry time to 5 minutes and the same timeout issue was observed.
Also after these retries, we tried to start the import. Here also we got timeout for the first time and on retry we got this error {"errorCode":"IN_PROGRESS","result":"error"}
.
Can someone recommend any best practices for passing attributes in /mapping
endpoint or how can we avoid timeouts?
Also, how much should be the wait time between starting the import and after the submitting schema and mapping configuration?