diff --git a/plugins/techdocs-backend/src/service/router.ts b/plugins/techdocs-backend/src/service/router.ts index 1a8bdb9c8f..ff47e16bc9 100644 --- a/plugins/techdocs-backend/src/service/router.ts +++ b/plugins/techdocs-backend/src/service/router.ts @@ -176,6 +176,11 @@ export async function createRouter({ // This block should be valid for all storage implementations. So no need to duplicate in future, // add the publisher type in the list here. const updated = await docsBuilder.build(); + + if (!updated) { + throw new NotModifiedError(); + } + // With a maximum of ~5 seconds wait, check if the files got published and if docs will be fetched // on the user's page. If not, respond with a message asking them to check back later. // The delay here is to make sure GCS/AWS/etc. registers newly uploaded files which is usually <1 second @@ -195,10 +200,6 @@ export async function createRouter({ ); } - if (!updated) { - throw new NotModifiedError(); - } - res .status(201) .json({ message: 'Docs updated or did not need updating' }); diff --git a/plugins/techdocs/src/client.ts b/plugins/techdocs/src/client.ts index 16617dcbce..83cfc88d56 100644 --- a/plugins/techdocs/src/client.ts +++ b/plugins/techdocs/src/client.ts @@ -192,7 +192,7 @@ export class TechDocsStorageClient implements TechDocsStorageApi { * Check if docs are on the latest version and trigger rebuild if not * * @param {EntityName} entityId Object containing entity data like name, namespace, etc. - * @returns {boolean} Whether documents are currently synchronized to newest version + * @returns {SyncResult} Whether documents are currently synchronized to newest version * @throws {Error} Throws error on error from sync endpoint in Techdocs Backend */ async syncEntityDocs(entityId: EntityName): Promise {