Issues in backlog doesn't update - reindexing needed

Linus Lindroth December 18, 2013

I have a strange problem where I update the Business Value in an issue, then go to the Agile board view and the value is still the old value. Note that I have selected Business Value as the Estimate so I can see that value in the roundish grey areas on each backlog item.

If i go back to the issue again I can confirm that the value is in fact changed to the new value. After about 1-2 minutes the value suddenly appears even in the Agile board backlog view. Why this delay? Can I do something about it? Since I use this value to help me sort the backlog it is quite annoying with this delay - I would expect it to be instant.

Thanks for any help

I'm using the latest version of JIRA and JIRA Agile with FishEye as plugin. The only plug-in I have is Script Runner and I use that to calculate the Business Value. So if I change due date or some other fields the Business Value instantly re-calculates and I can see the new value. However it doesn't seem to propagate to the Agile Board view instantly which is strange.

6 answers

1 accepted

0 votes
Answer accepted
Linus Lindroth January 29, 2014

I have now created a listener plugin using Atlassians tutorials for developers. That seems to work and the code looks like this:

package com.example.tutorial.plugins;

import com.atlassian.event.api.EventListener;
import com.atlassian.event.api.EventPublisher;
import com.atlassian.jira.event.issue.IssueEvent;
import com.atlassian.jira.event.type.EventType;
import com.atlassian.jira.issue.Issue;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.index.IndexException;
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder;
import com.atlassian.jira.issue.util.IssueChangeHolder;
import com.atlassian.jira.util.ImportUtils;
import com.atlassian.jira.issue.index.IssueIndexManager;

/**
* Simple JIRA listener using the atlassian-event library and demonstrating
* plugin lifecycle integration.
*/
public class IssueCreatedResolvedListener implements InitializingBean, DisposableBean {

private final EventPublisher eventPublisher;

/**
* Constructor.
* @parameventPublisher injected {@codeEventPublisher} implementation.
*/
public IssueCreatedResolvedListener(EventPublisher eventPublisher) {
this.eventPublisher = eventPublisher;
}

/**
* Called when the plugin has been enabled.
* @throws Exception
*/
@Override
public void afterPropertiesSet() throws Exception {
// register ourselves with the EventPublisher
eventPublisher.register(this);
}

/**
* Called when the plugin is being disabled or removed.
* @throws Exception
*/
@Override
public void destroy() throws Exception {
// unregister ourselves with the EventPublisher
eventPublisher.unregister(this);
}

private void reIndexIssue(Issue issue){
boolean wasIndexing = ImportUtils.isIndexIssues();
ImportUtils.setIndexIssues(true);
try {
ComponentAccessor.getIssueIndexManager().reIndex(issue);
} catch (IndexException e) {
System.out.println("Reindex error!!");
}finally{
ImportUtils.setIndexIssues(wasIndexing);
}
}

/**
* Receives any {@codeIssueEvent}s sent by JIRA.
* @paramissueEvent the IssueEvent passed to us
*/
@EventListener
public void onIssueEvent(IssueEvent issueEvent) {
//Long eventTypeId = issueEvent.getEventTypeId();
Issue issue = issueEvent.getIssue();
Issue parent = issue.getParentObject();
// if an event is triggered, re-index
//if (eventTypeId.equals(EventType.ISSUE_UPDATED_ID)) {
reIndexIssue(issue);
if (parent != null) {
reIndexIssue(parent);
}
//}
}
}

0 votes
Linus Lindroth January 13, 2014

I was wrong, it has nothing to do with time. But if I drag and drop the issue and press F5 it does update the value. So re-indexing seems to be the thing. See my question to one issue on your site if the fast-track issue could be updated so I can select "no transition" or "loop back to same transition". That way I could add the re-indexing code using that listener.

0 votes
JamieA
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 13, 2014

Does it appear in a standard query after the same amount of time, or immediately?

0 votes
Linus Lindroth January 13, 2014

Did you have any tips on how to script update the index?

0 votes
Linus Lindroth January 7, 2014

No I don't script update the index since I don't know how to do that? I also got the comment recently from Jamie from Script Runner that i should not try to update the issue from a scripted field "as you won't be able to reindex the issue without getting in to an infinite loop" he sais? I don't seem to have that problem though. He tells me to use a listener instead.

Any comments to that? How can I set the Business Value using a listener?

0 votes
Ubisoft
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 22, 2013

Maybe its due to the index since it use that in the Agile board. And when you check inside a issue, it get the value from the database. Do you script update the index each time ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events