ACR Rules

  1. Home
  2. Docs
  3. ACR Rules
  4. Performance (29)
  5. Only short actions should be used in a loop

Only short actions should be used in a loop

Introduced in version 1.4 (3 February 2020)

A loop can potentially be executed hundreds or thousands of times. Therefore it is preferable to avoid doing long-running actions in a loop.

Database retrieves can sometimes be refactored to 1 retrieve before the loop and a find-action on the list inside the loop.

Other long-running actions such as rest calls have no standard recipe to refactor. Consider this rule as a warning and whitelist them, or change the settings and allow certain actions

Rule configuration can define heavy actions:

[ {“Action”:”AppServiceCallAction”}, {“Action”:”DownloadFileAction”}, {“Action”:”JavaActionCallAction”}, {“Action”:”RetrieveAction”, “Database”: true}, {“Action”:”RestCallAction”}, {“Action”:”GenerateDocumentAction”}, {“Action”:”ExportXmlAction”} {“Action”:,”ImportXmlAction”} ]

Leaving the configuration empty takes this default.