Hi all,
I'm attempting to update a plugin that's currently timeing out when running a Custom Api action repeatedly for different entities. Right now the only way I can do this is using an external program to trigger the actions asynchronously, but I'd like to get this running from within a plugin.
I've already tried using the ExecuteAsyncRequest class, but this doesn't seem to work with custom API requests, and the ExecuteMultipleRequest class, which forces you to wait until all requests are finished.
I don't need to read the responses once the jobs are started as the results are logged elsewhere, and the order the requests are executed in don't matter.
Using a foreach loop is how the plugin was originally written, but there's simply too much work to do synchronously in 2 minutes. For the time being I've switched it to use the ExecuteMultipleRequest class as (based on my testing) this continues to execute even if the original plugin timed out minutes ago. I think the best long term solution to this is going to be moving the logic out into an azure function that's triggered by the plugin.
Howdy!
Instead of batching them and using execute multiple, have you looked at simply executing them individually?
Per the documentation:
docs.microsoft.com/.../execute-multiple-requests
"Custom code in the form of plug-ins and custom workflow activities may execute ExecuteMultipleRequest. However, this is not recommended"
Following the guidance here:
docs.microsoft.com/.../avoid-batch-requests-plugin
In the "Additional Information" sections it states:
ExecuteMultiple and ExecuteTransaction messages are considered batch request messages. Their purpose is to minimize round trips between client and server over high-latency connections. Plug-ins either execute directly within the application process or in close proximity when sandbox-isolated, meaning latency is rarely an issue. Plug-in code should be very focused operations that execute quickly and minimize blocking to avoid exceeding timeout thresholds and ensure a responsive system for synchronous scenarios. Simply submit each request directly instead of batching them and submitting as a single request.
For example: foreach (request in requests) service.Execute(request)
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156