We develop a plugin for Jira DC and implemented a calculated custom field. The calculation is heavy.
I observe that Jira triggers a calculation of the calculated custom field several times (4 times) on one issue page load. Why?
public class MyCustomField extends CalculatedCFType<Set<String>, String> {
@Override
public Set<String> getValueFromIssue(CustomField cf, Issue issue) {
// the function is called 4 times on one issue page load.
...
}
}
Is there some atlassian issue context where the calculated value can be cached between the calls to eliminate the extra 3 recalculations? Or how can I tell Jira to trigger the calculation once?
A clarification why the calculation is heavy: unfortunately the custom field is calculated because its value depends on a current jira user (a logged jira user), so we can not simply retrieve it from a lucene index.
Hi Irina,
I can't explain why fields are called four times on page load without a long essay on how Jira works on the back end and front end, which it has been a long time since I last looked.
Two of the runs can be explained briefly though
There is no way to cache a field value, and no way to stop Jira running it 2-4 times, it needs to because of what the field is doing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.