Skip to content

Commit

Permalink
ticket-1610 Fixed - Loop worker doesn't receive connected chains
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiy-skalelabs committed Oct 6, 2023
1 parent 5256b5e commit c64e0a1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions agent/loop.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -746,10 +746,8 @@ export async function ensureHaveWorkers( opts ) {
"strPathHashG1": opts.imaState.strPathHashG1,
"strPathBlsVerify": opts.imaState.strPathBlsVerify,
"isEnabledMultiCall": opts.imaState.isEnabledMultiCall,

"bNoWaitSChainStarted": opts.imaState.bNoWaitSChainStarted,
"nMaxWaitSChainAttempts": opts.imaState.nMaxWaitSChainAttempts,

"nTransferBlockSizeM2S": opts.imaState.nTransferBlockSizeM2S,
"nTransferBlockSizeS2M": opts.imaState.nTransferBlockSizeS2M,
"nTransferBlockSizeS2S": opts.imaState.nTransferBlockSizeS2S,
Expand All @@ -768,7 +766,6 @@ export async function ensureHaveWorkers( opts ) {
"nBlockAgeS2S": opts.imaState.nBlockAgeS2S,

"nLoopPeriodSeconds": opts.imaState.nLoopPeriodSeconds,

"nNodeNumber": opts.imaState.nNodeNumber,
"nNodesCount": opts.imaState.nNodesCount,
"nTimeFrameSeconds": opts.imaState.nTimeFrameSeconds,
Expand All @@ -781,7 +778,6 @@ export async function ensureHaveWorkers( opts ) {
"joDepositBoxERC1155": null,
"joDepositBoxERC721WithMetadata": null,
"joLinker": null,

"isWithMetadata721": false,

"joTokenManagerETH": null,
Expand Down Expand Up @@ -841,7 +837,6 @@ export async function ensureHaveWorkers( opts ) {
while( ! aClient.logicalInitComplete ) {
if( log.verboseGet() >= log.verboseReversed().info )
log.write( "LOOP server is not inited yet...\n" );

await threadInfo.sleep( 1000 );
aClient.send( jo );
}
Expand All @@ -863,6 +858,15 @@ export async function ensureHaveWorkers( opts ) {
if( threadInfo.isMainThread() )
notifyCacheChangedSNB( eventData.detail.arrSChainsCached );
} );
// Force broadcast what we have in SNB right now because works above can start later than SNB
// is finished download connected chains quickly
if( log.verboseGet() >= log.verboseReversed().debug ) {
log.write(
cc.debug( "Loop module will do first initial broadcast of arrSChainsCached to its " ) +
cc.info( cntWorkers ) + cc.debug( " worker(s) in " ) +
threadInfo.threadDescription() + cc.debug( "..." ) + "\n" );
}
notifyCacheChangedSNB( getLastCachedSChains() );
}

export async function runParallelLoops( opts ) {
Expand Down

0 comments on commit c64e0a1

Please sign in to comment.