You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2022/08/03 07:03:53 UTC

[incubator-devlake] branch main updated: fix the worklog collecting taking too long (#2662)

This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 2a505903 fix the worklog collecting taking too long (#2662)
2a505903 is described below

commit 2a505903a85f765a7b785ad4c48b0d891c8034e1
Author: mindlesscloud <li...@merico.dev>
AuthorDate: Wed Aug 3 15:03:49 2022 +0800

    fix the worklog collecting taking too long (#2662)
    
    * fix: fix the worklog collecting taking too long
    
    * fix: fix the changelog collecting taking too long
---
 plugins/jira/tasks/issue_changelog_collector.go | 4 ++--
 plugins/jira/tasks/worklog_collector.go         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/jira/tasks/issue_changelog_collector.go b/plugins/jira/tasks/issue_changelog_collector.go
index e6562731..4497f983 100644
--- a/plugins/jira/tasks/issue_changelog_collector.go
+++ b/plugins/jira/tasks/issue_changelog_collector.go
@@ -57,9 +57,9 @@ func CollectIssueChangelogs(taskCtx core.SubTaskContext) error {
 		dal.From("_tool_jira_board_issues bi"),
 		dal.Join("LEFT JOIN _tool_jira_issues i ON (bi.connection_id = i.connection_id AND bi.issue_id = i.issue_id)"),
 		dal.Join("LEFT JOIN _tool_jira_issue_changelogs c ON (c.connection_id = i.connection_id AND c.issue_id = i.issue_id)"),
-		dal.Where(`i.updated > i.created AND bi.connection_id = ?  AND bi.board_id = ? AND i.std_type != ? `, data.Options.ConnectionId, data.Options.BoardId, "Epic"),
+		dal.Where("i.updated > i.created AND bi.connection_id = ?  AND bi.board_id = ? AND i.std_type != ? ", data.Options.ConnectionId, data.Options.BoardId, "Epic"),
 		dal.Groupby("i.issue_id, i.updated"),
-		dal.Having("i.updated > max(c.issue_updated) OR  max(c.issue_updated) IS NULL"),
+		dal.Having("i.updated > max(c.issue_updated) OR  (max(c.issue_updated) IS NULL AND COUNT(c.changelog_id) > 0)"),
 	}
 	// apply time range if any
 	since := data.Since
diff --git a/plugins/jira/tasks/worklog_collector.go b/plugins/jira/tasks/worklog_collector.go
index 4d8b0e70..9d4694a8 100644
--- a/plugins/jira/tasks/worklog_collector.go
+++ b/plugins/jira/tasks/worklog_collector.go
@@ -53,7 +53,7 @@ func CollectWorklogs(taskCtx core.SubTaskContext) error {
 		dal.Join("LEFT JOIN _tool_jira_worklogs wl ON (wl.connection_id = i.connection_id AND wl.issue_id = i.issue_id)"),
 		dal.Where("i.updated > i.created AND bi.connection_id = ?  AND bi.board_id = ?  ", data.Options.ConnectionId, data.Options.BoardId),
 		dal.Groupby("i.issue_id, i.updated"),
-		dal.Having("i.updated > max(wl.issue_updated) OR  max(wl.issue_updated) IS NULL"),
+		dal.Having("i.updated > max(wl.issue_updated) OR  (max(wl.issue_updated) IS NULL AND COUNT(wl.worklog_id) > 0)"),
 	}
 	// apply time range if any
 	if since != nil {