Fix minor issues from the review comments

Signed-off-by: Dominik Henneke <dominik.henneke@sda-se.com>
This commit is contained in:
Dominik Henneke
2021-06-16 11:04:26 +02:00
parent 1dfec7a2ae
commit 2b9d30b153
2 changed files with 6 additions and 5 deletions
@@ -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' });
+1 -1
View File
@@ -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<SyncResult> {