@@ -33,6 +33,8 @@ class PublishFinalizationCommand extends Command {
3333 const { id, publishOperationId, merkleRoot, byteSize } = eventData ;
3434 const { blockchain, contractAddress } = event ;
3535 const operationId = this . operationIdService . generateId ( ) ;
36+ const ual = this . ualService . deriveUAL ( blockchain , contractAddress , id ) ;
37+
3638 this . operationIdService . emitChangeEvent (
3739 OPERATION_ID_STATUS . PUBLISH_FINALIZATION . PUBLISH_FINALIZATION_START ,
3840 operationId ,
@@ -70,8 +72,10 @@ class PublishFinalizationCommand extends Command {
7072 cachedMerkleRoot = result . merkleRoot ;
7173 assertion = result . assertion ;
7274 publisherPeerId = result . remotePeerId ;
73- } catch ( error ) {
74- this . logger . error ( `Failed to read cached publish data: ${ error . message } ` ) ; // TODO: Make this log more descriptive
75+ } catch ( _error ) {
76+ this . logger . warn (
77+ `[Cache] Failed to read cached publish data for UAL ${ ual } (publishOperationId: ${ publishOperationId } , txHash: ${ txHash } , operationId: ${ operationId } )` ,
78+ ) ;
7579 this . operationIdService . emitChangeEvent (
7680 OPERATION_ID_STATUS . FAILED ,
7781 operationId ,
@@ -81,8 +85,6 @@ class PublishFinalizationCommand extends Command {
8185 return Command . empty ( ) ;
8286 }
8387
84- const ual = this . ualService . deriveUAL ( blockchain , contractAddress , id ) ;
85-
8688 try {
8789 await this . validatePublishData ( merkleRoot , cachedMerkleRoot , byteSize , assertion , ual ) ;
8890 } catch ( e ) {
@@ -185,23 +187,24 @@ class PublishFinalizationCommand extends Command {
185187
186188 async readWithRetries ( publishOperationId ) {
187189 let attempt = 0 ;
190+ const datasetPath = this . fileService . getPendingStorageDocumentPath ( publishOperationId ) ;
188191
189192 while ( attempt < MAX_RETRIES_READ_CACHED_PUBLISH_DATA ) {
190193 try {
191- const datasetPath =
192- this . fileService . getPendingStorageDocumentPath ( publishOperationId ) ;
193194 // eslint-disable-next-line no-await-in-loop
194195 const cachedData = await this . fileService . readFile ( datasetPath , true ) ;
195196 return cachedData ;
196197 } catch ( error ) {
197198 attempt += 1 ;
198-
199199 // eslint-disable-next-line no-await-in-loop
200200 await new Promise ( ( resolve ) => {
201201 setTimeout ( resolve , RETRY_DELAY_READ_CACHED_PUBLISH_DATA ) ;
202202 } ) ;
203203 }
204204 }
205+ this . logger . warn (
206+ `[Cache] Exhausted retries reading cached publish data (publishOperationId: ${ publishOperationId } , path: ${ datasetPath } ).` ,
207+ ) ;
205208 // TODO: Mark this operation as failed
206209 throw new Error ( 'Failed to read cached publish data' ) ;
207210 }
0 commit comments