From c1338e2b10182c10d87b1885a7d1e5283263a8a9 Mon Sep 17 00:00:00 2001 From: Thomas Taylor Date: Fri, 27 Mar 2026 16:42:53 +0000 Subject: [PATCH 1/2] Fix: Resolve circular dependency deadlock with content module contentplugin.init() awaited the content module, but content.init() also awaits contentplugin, causing both modules to deadlock and timeout. Use .then() for the content hook tap so contentplugin can signal ready without waiting for content. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/ContentPluginModule.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ContentPluginModule.js b/lib/ContentPluginModule.js index 45fae64..5480f52 100644 --- a/lib/ContentPluginModule.js +++ b/lib/ContentPluginModule.js @@ -45,7 +45,7 @@ class ContentPluginModule extends AbstractApiModule { if (!process.env.ADAPT_ALLOW_PRERELEASE) { process.env.ADAPT_ALLOW_PRERELEASE = 'true' } - const [framework, mongodb, content] = await this.app.waitForModule('adaptframework', 'mongodb', 'content') + const [framework, mongodb] = await this.app.waitForModule('adaptframework', 'mongodb') await mongodb.setIndex(this.collectionName, 'name', { unique: true }) await mongodb.setIndex(this.collectionName, 'displayName', { unique: true }) @@ -61,7 +61,9 @@ class ContentPluginModule extends AbstractApiModule { } catch (e) { this.log('error', e) } - content.preInsertHook.tap((...args) => addDefaultPlugins(this, ...args)) + this.app.waitForModule('content').then(content => { + content.preInsertHook.tap((...args) => addDefaultPlugins(this, ...args)) + }) this.framework.postInstallHook.tap(this.syncPluginData.bind(this)) this.framework.postUpdateHook.tap(this.syncPluginData.bind(this)) } From 5b6fc6f1ac746272586928676b59b319b460f6fd Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Fri, 27 Mar 2026 17:08:22 +0000 Subject: [PATCH 2/2] Move code ordering for readability Removed duplicate tap calls for postInstallHook and postUpdateHook. --- lib/ContentPluginModule.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ContentPluginModule.js b/lib/ContentPluginModule.js index 5480f52..fd397c1 100644 --- a/lib/ContentPluginModule.js +++ b/lib/ContentPluginModule.js @@ -61,11 +61,11 @@ class ContentPluginModule extends AbstractApiModule { } catch (e) { this.log('error', e) } + this.framework.postInstallHook.tap(this.syncPluginData.bind(this)) + this.framework.postUpdateHook.tap(this.syncPluginData.bind(this)) this.app.waitForModule('content').then(content => { content.preInsertHook.tap((...args) => addDefaultPlugins(this, ...args)) }) - this.framework.postInstallHook.tap(this.syncPluginData.bind(this)) - this.framework.postUpdateHook.tap(this.syncPluginData.bind(this)) } /** @override */