diff --git a/consumer-server/src/logic/conversion-task.ts b/consumer-server/src/logic/conversion-task.ts index 06f6595..f0ce8a1 100644 --- a/consumer-server/src/logic/conversion-task.ts +++ b/consumer-server/src/logic/conversion-task.ts @@ -240,13 +240,13 @@ export async function executeConversion( if ($BUILD_TARGET !== 'webgl') { try { - hasContentChanged = await hasContentChange(entityId, contentServerUrl, $BUILD_TARGET, outDirectory) + hasContentChanged = await hasContentChange(entityId, contentServerUrl, $BUILD_TARGET, outDirectory, logger) } catch (e) { - console.log('HasContentChanged failed with error ' + e) + logger.info('HasContentChanged failed with error ' + e) } } - console.log(`HasContentChanged for ${entityId} result was ${hasContentChanged}`) + logger.info(`HasContentChanged for ${entityId} result was ${hasContentChanged}`) let exitCode try { diff --git a/consumer-server/src/logic/has-content-changed-task.ts b/consumer-server/src/logic/has-content-changed-task.ts index 808c018..c185bb6 100644 --- a/consumer-server/src/logic/has-content-changed-task.ts +++ b/consumer-server/src/logic/has-content-changed-task.ts @@ -1,7 +1,8 @@ import { Entity } from '@dcl/schemas' import * as fs from 'fs' import * as path from 'path' -import fetch from 'node-fetch' // Assuming you're using the node-fetch package +import fetch from 'node-fetch' +import { ILoggerComponent } from '@well-known-components/interfaces' // Assuming you're using the node-fetch package async function getActiveEntity(ids: string, contentServer: string): Promise { const url = `${contentServer}/entities/active` @@ -146,17 +147,22 @@ export async function hasContentChange( entityId: string, contentServerUrl: string, buildTarget: string, - outputFolder: string + outputFolder: string, + logger: ILoggerComponent.ILogger ): Promise { const entity = await getActiveEntity(entityId, contentServerUrl) if (entity.type === 'scene') { + logger.info(`HasContentChanged: Entity ${entityId} is a scene`) const previousHash = await getLastEntityIdByBase(entity.metadata.scene.base, contentServerUrl) if (previousHash !== null) { + logger.info(`HasContentChanged: Previous hash is ${previousHash}`) const manifest = await getManifestFiles(previousHash, buildTarget) if (manifest !== null) { + logger.info(`HasContentChanged: Manifest exists for hash ${previousHash}`) const hashes = extractValidHashesFromEntity(entity.content) const doesEntityMatchHashes = AreAllContentHashesInManifest(hashes, manifest.files) if (doesEntityMatchHashes) { + logger.info(`HasContentChanged: All entities contained in old manifest`) const allFilesDownloadSuccesfully = await downloadFilesFromManifestSuccesfully( hashes, manifest.version, @@ -168,6 +174,7 @@ export async function hasContentChange( if (allFilesDownloadSuccesfully) { return false } else { + logger.info(`HasContentChanged: Some downloads failed`) //In case we downloaded some file, remove the corrupt state await DeleteFilesInOutputFolder(outputFolder) }