Created
May 19, 2020 16:52
-
-
Save jechlin-adaptavist/18f9d7f2dd6a44c5d58ca05c33e2cd28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.bc.issue.search.SearchService | |
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.jira.jql.builder.JqlQueryBuilder | |
import com.atlassian.jira.util.thread.JiraThreadLocalUtils | |
def searchService = ComponentAccessor.getComponent(SearchService) | |
def customFieldManager = ComponentAccessor.customFieldManager | |
def storyPointsCf = customFieldManager.getCustomFieldObjectByName('Story Points') | |
def issue = event.issue | |
Thread.start { | |
sleep(1_000) | |
JiraThreadLocalUtils.preCall() | |
try { | |
def builder = JqlQueryBuilder.newBuilder() | |
def query = builder.where().issue(issue.key).and().customField(storyPointsCf.idAsLong).notEq(0).buildQuery() | |
def count = searchService.searchCountOverrideSecurity(event.user, query) | |
if (count > 0) { | |
log.error("Issue: ${issue.key} was not indexed properly", new Exception('indexing failure')) | |
} | |
} | |
finally { | |
JiraThreadLocalUtils.postCall(log, null) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment