From dd39eb38af4ee3b58ae355373eb71c1e532b677a Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Tue, 3 Dec 2024 21:09:08 +0100 Subject: [PATCH] Add sync by query to run in background to prevent blocking the main thread --- .../infra/replicate/jira/service/jira/JiraService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/hibernate/infra/replicate/jira/service/jira/JiraService.java b/src/main/java/org/hibernate/infra/replicate/jira/service/jira/JiraService.java index b50184d..6e4d873 100644 --- a/src/main/java/org/hibernate/infra/replicate/jira/service/jira/JiraService.java +++ b/src/main/java/org/hibernate/infra/replicate/jira/service/jira/JiraService.java @@ -228,7 +228,7 @@ public void registerManagementRoutes(@Observes ManagementInterface mi) { // syncs only assignee/body, without links comments and transitions String project = rc.pathParam("project"); String query = rc.queryParam("query").getFirst(); - String applyTransitionUpdate = rc.queryParam("applyTransitionUpdate").getFirst(); + boolean applyTransitionUpdate = "true".equalsIgnoreCase(rc.queryParam("applyTransitionUpdate").getFirst()); HandlerProjectContext context = contextPerProject.get(project); @@ -236,9 +236,9 @@ public void registerManagementRoutes(@Observes ManagementInterface mi) { throw new IllegalArgumentException("Unknown project '%s'".formatted(project)); } - syncByQuery(query, context, + context.submitTask(() -> syncByQuery(query, context, jiraIssue -> context.submitTask(new JiraIssueSimpleUpsertEventHandler(reportingConfig, context, - jiraIssue, "true".equals(applyTransitionUpdate)))); + jiraIssue, applyTransitionUpdate)))); rc.end(); }); mi.router().post("/sync/comments/list").consumes(MediaType.APPLICATION_JSON).blockingHandler(rc -> {