@@ -283,11 +283,11 @@ export const main = async (_config, _options, justKill) => {
283
283
284
284
if ( options . graph ) {
285
285
try {
286
- console . log ( 'Starting postgres...' )
287
- await compose . upOne ( 'postgres' , opts )
288
- console . log ( 'Starting ipfs...' )
289
- await compose . upOne ( 'ipfs' , opts )
290
- console . log ( 'Starting graph-node...' )
286
+ // console.log('Starting postgres...')
287
+ // await compose.upOne('postgres', opts)
288
+ // console.log('Starting ipfs...')
289
+ // await compose.upOne('ipfs', opts)
290
+ // console.log('Starting graph-node...')
291
291
await compose . upOne ( 'graph-node' , opts )
292
292
console . log ( 'Starting metadata...' )
293
293
// await compose.upOne('metadata', opts)
@@ -352,6 +352,14 @@ export const main = async (_config, _options, justKill) => {
352
352
353
353
if ( ! options . save && cmdsToRun . length > 0 && options . scripts ) {
354
354
if ( options . graph ) {
355
+
356
+ const latestBlock = await rpcFetch ( 'eth_getBlockByNumber' , [ 'latest' , false ] )
357
+ const latestBlockNumber = parseInt ( latestBlock . result . number , 16 )
358
+ if ( Number . isNaN ( latestBlockNumber ) ) {
359
+ console . error ( 'Failed to fetch latest block number' )
360
+ return cleanup ( undefined , 0 )
361
+ }
362
+
355
363
let indexArray = [ ]
356
364
const getCurrentIndex = async ( ) =>
357
365
fetch ( 'http://localhost:8000/subgraphs/name/graphprotocol/ens' , {
@@ -385,13 +393,11 @@ export const main = async (_config, _options, justKill) => {
385
393
if ( indexArray . length > 10 ) indexArray . shift ( )
386
394
await new Promise ( ( resolve ) => setTimeout ( resolve , 1000 ) )
387
395
if ( indexArray . every ( ( i ) => i === indexArray [ 0 ] ) && indexArray . length === 10 ) {
396
+ console . error ( 'Subgraph failed to launch properly' )
388
397
return cleanup ( undefined , 0 )
389
398
}
390
399
} while (
391
- indexArray [ indexArray . length - 1 ] < 326
392
- // !indexArray.every((i) => i === indexArray[0]) ||
393
- // indexArray.length < 2 ||
394
- // indexArray[0] === 0
400
+ indexArray [ indexArray . length - 1 ] < latestBlockNumber
395
401
)
396
402
}
397
403
/**
0 commit comments