diff --git a/server/routerlicious/packages/routerlicious-base/src/alfred/routes/api/documents.ts b/server/routerlicious/packages/routerlicious-base/src/alfred/routes/api/documents.ts index 5c6e3390182e..0756e3f5048e 100644 --- a/server/routerlicious/packages/routerlicious-base/src/alfred/routes/api/documents.ts +++ b/server/routerlicious/packages/routerlicious-base/src/alfred/routes/api/documents.ts @@ -93,6 +93,8 @@ export function create( // Protocol state const { sequenceNumber, values, generateToken = false } = request.body; + const enableDiscovery: boolean = request.body.enableDiscovery ?? false; + const createP = storage.createDocument( tenantId, id, @@ -102,9 +104,8 @@ export function create( crypto.randomBytes(4).toString("hex"), ordererUrl, historianUrl, - values); - - const enableDiscovery: boolean = request.body.enableDiscovery ?? false; + values, + enableDiscovery); // Handle backwards compatibility for older driver versions. // TODO: remove condition once old drivers are phased out and all clients can handle object response diff --git a/server/routerlicious/packages/routerlicious-base/src/utils/sessionHelper.ts b/server/routerlicious/packages/routerlicious-base/src/utils/sessionHelper.ts index cc50b02036e0..04226a1783d7 100644 --- a/server/routerlicious/packages/routerlicious-base/src/utils/sessionHelper.ts +++ b/server/routerlicious/packages/routerlicious-base/src/utils/sessionHelper.ts @@ -76,6 +76,7 @@ export async function getSession(ordererUrl: string, // The tempSession.isSessionAlive would be updated as whether the session was alive before the request came. tempSession.isSessionAlive = isSessionAlive; - Lumberjack.info(`Returning the session: ${JSON.stringify(tempSession)}`, lumberjackProperties); + Lumberjack.info(`Returning the session from the discovery: ${JSON.stringify(tempSession)}`, + lumberjackProperties); return tempSession; } diff --git a/server/routerlicious/packages/services-core/src/document.ts b/server/routerlicious/packages/services-core/src/document.ts index cd13abd5df74..ecbf75b0ebf3 100644 --- a/server/routerlicious/packages/services-core/src/document.ts +++ b/server/routerlicious/packages/services-core/src/document.ts @@ -36,7 +36,8 @@ export interface IDocumentStorage { initialHash: string, ordererUrl: string, historianUrl: string, - values: [string, ICommittedProposal][]): Promise; + values: [string, ICommittedProposal][], + enableDiscovery: boolean): Promise; } export interface IClientSequenceNumber { diff --git a/server/routerlicious/packages/services-shared/src/storage.ts b/server/routerlicious/packages/services-shared/src/storage.ts index 26e487ae8426..05b0b6b97113 100644 --- a/server/routerlicious/packages/services-shared/src/storage.ts +++ b/server/routerlicious/packages/services-shared/src/storage.ts @@ -121,6 +121,7 @@ export class DocumentStorage implements IDocumentStorage { ordererUrl: string, historianUrl: string, values: [string, ICommittedProposal][], + enableDiscovery: boolean = false, ): Promise { const tenant = await this.tenantManager.getTenant(tenantId, documentId); const gitManager = tenant.gitManager; @@ -197,8 +198,9 @@ export class DocumentStorage implements IDocumentStorage { isSessionAlive: true, }; - winston.info(`Session: ${JSON.stringify(session)}`, { messageMetaData }); - Lumberjack.info(`Session: ${JSON.stringify(session)}`, lumberjackProperties); + const message: string = `Create session with enableDiscovery as ${enableDiscovery}: ${JSON.stringify(session)}`; + winston.info(message, { messageMetaData }); + Lumberjack.info(message, lumberjackProperties); const collection = await this.databaseManager.getDocumentCollection(); const result = await collection.findOrCreate( diff --git a/server/routerlicious/packages/test-utils/src/testDocumentStorage.ts b/server/routerlicious/packages/test-utils/src/testDocumentStorage.ts index fb197000ccd7..dd256adda06c 100644 --- a/server/routerlicious/packages/test-utils/src/testDocumentStorage.ts +++ b/server/routerlicious/packages/test-utils/src/testDocumentStorage.ts @@ -62,6 +62,7 @@ export class TestDocumentStorage implements IDocumentStorage { ordererUrl: string, historianUrl: string, values: [string, ICommittedProposal][], + enableDiscovery: boolean = false, ): Promise { const tenant = await this.tenantManager.getTenant(tenantId, documentId); const gitManager = tenant.gitManager;