Merge branch 'master' into simon/vscode-default-relative-imports
This commit is contained in:
		
						commit
						73e8c59085
					
				@ -62,9 +62,24 @@ class DiskCache {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wipeCache() {
 | 
					  wipeCache() {
 | 
				
			||||||
    fs.unlinkSync(DiskCache.FILE_NAME);
 | 
					    logger.notice(`Wipping nodejs backend cache/cache*.json files`);
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					      fs.unlinkSync(DiskCache.FILE_NAME);
 | 
				
			||||||
 | 
					    } catch (e: any) {
 | 
				
			||||||
 | 
					      if (e?.code !== 'ENOENT') {
 | 
				
			||||||
 | 
					        logger.err(`Cannot wipe cache file ${DiskCache.FILE_NAME}. Exception ${JSON.stringify(e)}`);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (let i = 1; i < DiskCache.CHUNK_FILES; i++) {
 | 
					    for (let i = 1; i < DiskCache.CHUNK_FILES; i++) {
 | 
				
			||||||
      fs.unlinkSync(DiskCache.FILE_NAMES.replace('{number}', i.toString()));
 | 
					      const filename = DiskCache.FILE_NAMES.replace('{number}', i.toString());
 | 
				
			||||||
 | 
					      try {
 | 
				
			||||||
 | 
					        fs.unlinkSync(filename);
 | 
				
			||||||
 | 
					      } catch (e: any) {
 | 
				
			||||||
 | 
					        if (e?.code !== 'ENOENT') {
 | 
				
			||||||
 | 
					          logger.err(`Cannot wipe cache file ${filename}. Exception ${JSON.stringify(e)}`);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ import logger from '../logger';
 | 
				
			|||||||
import config from '../config';
 | 
					import config from '../config';
 | 
				
			||||||
import PoolsRepository from '../repositories/PoolsRepository';
 | 
					import PoolsRepository from '../repositories/PoolsRepository';
 | 
				
			||||||
import { PoolTag } from '../mempool.interfaces';
 | 
					import { PoolTag } from '../mempool.interfaces';
 | 
				
			||||||
 | 
					import diskCache from './disk-cache';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PoolsParser {
 | 
					class PoolsParser {
 | 
				
			||||||
  miningPools: any[] = [];
 | 
					  miningPools: any[] = [];
 | 
				
			||||||
@ -141,6 +142,10 @@ class PoolsParser {
 | 
				
			|||||||
      WHERE pool_id = ?`,
 | 
					      WHERE pool_id = ?`,
 | 
				
			||||||
      [pool.id]
 | 
					      [pool.id]
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // We also need to wipe the backend cache to make sure we don't serve blocks with
 | 
				
			||||||
 | 
					    // the wrong mining pool (usually happen with unknown blocks)
 | 
				
			||||||
 | 
					    diskCache.wipeCache();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private async $deleteUnknownBlocks(): Promise<void> {
 | 
					  private async $deleteUnknownBlocks(): Promise<void> {
 | 
				
			||||||
@ -151,6 +156,10 @@ class PoolsParser {
 | 
				
			|||||||
      WHERE pool_id = ? AND height >= 130635`,
 | 
					      WHERE pool_id = ? AND height >= 130635`,
 | 
				
			||||||
      [unknownPool[0].id]
 | 
					      [unknownPool[0].id]
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // We also need to wipe the backend cache to make sure we don't serve blocks with
 | 
				
			||||||
 | 
					    // the wrong mining pool (usually happen with unknown blocks)
 | 
				
			||||||
 | 
					    diskCache.wipeCache();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								frontend/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								frontend/.gitignore
									
									
									
									
										vendored
									
									
								
							@ -54,6 +54,7 @@ src/resources/assets-testnet.json
 | 
				
			|||||||
src/resources/assets-testnet.minimal.json
 | 
					src/resources/assets-testnet.minimal.json
 | 
				
			||||||
src/resources/pools.json
 | 
					src/resources/pools.json
 | 
				
			||||||
src/resources/mining-pools/*
 | 
					src/resources/mining-pools/*
 | 
				
			||||||
 | 
					src/resources/*.mp4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# environment config
 | 
					# environment config
 | 
				
			||||||
mempool-frontend-config.json
 | 
					mempool-frontend-config.json
 | 
				
			||||||
 | 
				
			|||||||
@ -36,6 +36,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  video {
 | 
					  video {
 | 
				
			||||||
    width: 640px;
 | 
					    width: 640px;
 | 
				
			||||||
 | 
					    height: 360px;
 | 
				
			||||||
    max-width: 90%;
 | 
					    max-width: 90%;
 | 
				
			||||||
    margin-top: 0;
 | 
					    margin-top: 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user