Order of nested post-function executions/creations

Steven Mustari
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 31, 2019

I have a post-function on issue A that creates issue B and conditionally issue B may or may not create create issue C. All of these issues are on different workflows.(don't)

What is the order in which these post-functions are executed?

My primary point of discovery here is to determine when exactly the first execution stores and re-indexes, as within creation B or C, I would like to come back and potentially clear a field on A or B.

Regards,
Steven

1 answer

1 accepted

1 vote
Answer accepted
C_ Derek Fields
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 1, 2020

Post-functions fire in the order in which they are called. Issue A creates Issue B. The creation of issue B may create Issue C. It will happen in that order. 

I think your real question is the order of the reindexing? I am not sure, but it may be indeterminate. If the plugin that creates the new issue spawns a new thread to create the new issue and run its Create post-functions, then you may not be able to reliably count on the order in which the threads complete.

If it all occurs in a single thread, then I would expect all of C's Create post-functions to complete before B continues and all of B's post-functions to complete before A continues.

Steven Mustari
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2020

Thank you Derek, I think the reindexing part is what was concerning, I didn't think about each of these processes opening on a different thread, therefore unreliable order, which at times explains some unexpected behavior.

Regards,
Steven

Suggest an answer

Log in or Sign up to answer