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.