From 790a98e37b907ee967e0c5fb317727568ada3524 Mon Sep 17 00:00:00 2001 From: Raymond Rebbeck Date: Sat, 16 May 2026 22:34:39 +0930 Subject: [PATCH 1/2] In ImportAll create a work queue manager to use for importing items to improve performance Currently only used when not compiling. When compiling the pull event handler is used which will require a different work queue manager implementation. --- cls/SourceControl/Git/Utils.cls | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index 78337670..68892fee 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -1670,6 +1670,18 @@ ClassMethod ImportRoutines(force As %Boolean = 0, pullEventClass As %String) As kill files set settings = ##class(SourceControl.Git.Settings).%New() + + // Create a work queue manager to use for importing items to improve performance + // Currently only used when not compiling + #dim queue as %SYSTEM.WorkMgr = "" + if ('settings.compileOnImport) { + set queue = ##class(%SYSTEM.WorkMgr).%New() + if (queue = "") { + set ec = $$$ADDSC(ec, %objlasterror) + quit:'ec ec + } + } + #dim internalName as %String = "" for { set internalName = $order(itemList(internalName)) @@ -1697,7 +1709,13 @@ ClassMethod ImportRoutines(force As %Boolean = 0, pullEventClass As %String) As set files($increment(files)) = modification } else { // If not compiling then import now as otherwise it won't happen - set sc = ..ImportItem(internalName, force) + set sc = $$$OK + // If a work queue has been created then use it + if (queue '= "") { + set sc = queue.Queue("..ImportItem", internalName, force) + } else { + set sc = ..ImportItem(internalName, force) + } if $$$ISERR(sc) { set ec = $$$ADDSC(ec, sc) } @@ -1705,6 +1723,13 @@ ClassMethod ImportRoutines(force As %Boolean = 0, pullEventClass As %String) As } } + // If a work queue was created then wait for all work to finish + if (queue '= "") { + set sc = queue.Sync() + if $$$ISERR(sc) { + set ec = $$$ADDSC(ec, sc) + } + } //let's delete all items for which corresponding files had been deleted #dim item as %String = "" From 1740e1021c779cb25a728e62e6026ff0dae50c3a Mon Sep 17 00:00:00 2001 From: Raymond Rebbeck Date: Sat, 16 May 2026 22:54:35 +0930 Subject: [PATCH 2/2] In ImportAll don't use a work queue manager to import items when decomposed productions are in use It seems very likely that there would be race conditions within ImportItem without further locking being implemented to ensure that productions are created and updated safely. --- cls/SourceControl/Git/Utils.cls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index 68892fee..fc21b519 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -1672,9 +1672,9 @@ ClassMethod ImportRoutines(force As %Boolean = 0, pullEventClass As %String) As set settings = ##class(SourceControl.Git.Settings).%New() // Create a work queue manager to use for importing items to improve performance - // Currently only used when not compiling + // Currently only used when not compiling and not using decomposed productions #dim queue as %SYSTEM.WorkMgr = "" - if ('settings.compileOnImport) { + if ('settings.compileOnImport && 'settings.decomposeProductions) { set queue = ##class(%SYSTEM.WorkMgr).%New() if (queue = "") { set ec = $$$ADDSC(ec, %objlasterror)