diff --git a/packages/cli/src/ceramic-daemon.ts b/packages/cli/src/ceramic-daemon.ts index a2789a0f93..46d68939db 100644 --- a/packages/cli/src/ceramic-daemon.ts +++ b/packages/cli/src/ceramic-daemon.ts @@ -90,7 +90,8 @@ export function makeCeramicConfig(opts: DaemonConfig): CeramicConfig { syncOverride: SYNC_OPTIONS_MAP[opts.node.syncOverride], streamCacheLimit: opts.node.streamCacheLimit, indexing: opts.indexing, - disablePeerDataSync: opts.ipfs.disablePeerDataSync, + disablePeerDataSync: + opts.ipfs.disablePeerDataSync || process.env.CERAMIC_DISABLE_PEER_DATA_SYNC == 'true', metrics: opts.metrics, } if (opts.stateStore?.mode == StateStoreMode.FS) { diff --git a/packages/core/src/dispatcher.ts b/packages/core/src/dispatcher.ts index c2cef4518d..94831f8fac 100644 --- a/packages/core/src/dispatcher.ts +++ b/packages/core/src/dispatcher.ts @@ -140,7 +140,7 @@ export class Dispatcher { const rustCeramic = EnvironmentUtils.useRustCeramic() this.enableSync = rustCeramic ? false : enableSync - if (!rustCeramic) { + if (!this.enableSync) { const pubsub = new Pubsub( _ipfs, topic, @@ -178,10 +178,9 @@ export class Dispatcher { } async init() { - if (EnvironmentUtils.useRustCeramic()) { - return + if (this.enableSync) { + this.messageBus.subscribe(this.handleMessage.bind(this)) } - this.messageBus.subscribe(this.handleMessage.bind(this)) } get shutdownSignal(): ShutdownSignal { @@ -498,7 +497,7 @@ export class Dispatcher { * @param tip - Commit CID */ publishTip(streamId: StreamID, tip: CID, model?: StreamID): Subscription { - if (process.env.CERAMIC_DISABLE_PUBSUB_UPDATES == 'true' || EnvironmentUtils.useRustCeramic()) { + if (process.env.CERAMIC_DISABLE_PUBSUB_UPDATES == 'true' || !this.enableSync) { return empty().subscribe() } @@ -621,7 +620,7 @@ export class Dispatcher { * Gracefully closes the Dispatcher. */ async close(): Promise { - if (!EnvironmentUtils.useRustCeramic()) { + if (this.enableSync) { this.messageBus.unsubscribe() } await this.tasks.onIdle()