PL-400 · Question #375
A company requires a plug-in that makes multiple requests to an external web service. The plug- in must not time out when the web service has issues or is slow to respond. You need to create the plug-
The correct answer is D. Set the HTTP connection KeepAlive property to false.. To mitigate timeouts in a plug-in making multiple external web service requests, especially when the service is slow, setting the HTTP connection's KeepAlive property to false can help prevent issues with persistent connections.
Question
Options
- AAssign the IOrganizationService object to a member variable.
- BRegister the plug-in to run synchronously.
- CRegister the plug-in step once for each web service request.
- DSet the HTTP connection KeepAlive property to false.
How the community answered
(29 responses)- A17% (5)
- B3% (1)
- C7% (2)
- D72% (21)
Why each option
To mitigate timeouts in a plug-in making multiple external web service requests, especially when the service is slow, setting the HTTP connection's KeepAlive property to false can help prevent issues with persistent connections.
Assigning the IOrganizationService object to a member variable is an anti-pattern as IOrganizationService instances are not thread-safe and should be obtained per execution context; it does not affect external web service timeouts.
Registering the plug-in synchronously means it runs within the transaction and is subject to the Dataverse plug-in execution timeout (typically 2 minutes), increasing the likelihood of a timeout if the external service is slow.
Registering the plug-in step once for each web service request would not resolve a timeout issue for a single, long-running external call within one plug-in's execution.
Setting the KeepAlive property to false for the HttpClient or HttpWebRequest used within the plug-in ensures that the connection is closed after each request. This can help prevent the plug-in from timing out by avoiding issues with stale, mismanaged, or long-held persistent connections when dealing with an unreliable or slow external service.
Concept tested: Plug-in external service call timeouts
Source: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/best-practices/business-logic/use-web-services
Community Discussion
No community discussion yet for this question.