Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to wait for indexing to be complete

Beppe Marcon June 19, 2018

//how to wait for indexing to be complete?

IssueIndexingService indexService = ComponentAccessor.getComponent(IssueIndexingService)
long reindexTime = indexService.reIndexAll()

#after reindex has finished run a JQL query

1 answer

0 votes
Moses Thomas
Community Champion
June 19, 2018

@Beppe MarconI don't  get you ,  once you trigger(background or fore ground indexing)  you  need  to  wait,  and you  waiting  depends on how  large  is  your instance.  therefore what  do  you  want to  achieve  here ?

 

Best!

Beppe Marcon June 19, 2018

my JQL isn't able to find certain link types between issues which have been created in the same Groovy postfunction running the JQL. I want to reindex at a certain point of the postfunction and run the JQL only after reindex has completed in order for the JQL to find all nodes and link types present.
How do I poll for completion and only after completion continue with my groovy postfunction?

Nic Brough -Adaptavist-
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.
June 20, 2018

In a post-function, you probably only want to re-index the current issue, or possibly a small set of issues that have a relationship with it (for example, as you suggest, all linked issues).

If you are indexing a small set of issues in the post-function, then you don't need to wait - the indexing for each is complete before it does the next step in the function.

Beppe Marcon June 20, 2018

Reindexing single issue doesn't update links, I've tried the following:

boolean wasIndexing = ImportUtils.isIndexIssues()
ImportUtils.setIndexIssues(true)
IssueIndexManager indexManager = ComponentAccessor.getComponent(IssueIndexManager)
indexManager.reIndex(issue)
ImportUtils.setIndexIssues(wasIndexing)

still the JQL run after the above returns empty result, the same JQL in a separate postfunction returns correct results.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events