Scope of the global object for rules execution

Hi,

I have a sequence of 5 rules that are executed for every login flow. As a part of refactoring the rules we are planning to move the common functions to a global variable so that they are defined only once. We plan on using the webtask containers global object to do the same. We know that the global object may be recycled anytime and we should not use it for long persistent storage. We had the below questions in relation to this:

  1. Will all the 5 rules run in the same webtask container per execution context? Can 2 rules run in one container and 3 others in another per login flow.
  2. If we define the function to the global object in the first rule, is it guaranteed that the same global object is available for all 5 rules. i.e the global object is not refreshed after executing 2 rules, making our common functions unavailable in the 3rd rule.

Hi!

All rules will run in the same container. The server packages all the rules together to be run as a single webtask.

That is correct, the same global object will be available for all 5 rules (as a consequence of all rules being treated as a single Webtask run).

1 Like

Awesome,

Thanks for the confirmation.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.