Make sure to release all db connections
This commit is contained in:
		
							parent
							
								
									19a564062b
								
							
						
					
					
						commit
						a1a2e9363f
					
				@ -67,7 +67,14 @@ class PoolsParser {
 | 
			
		||||
 | 
			
		||||
    // Get existing pools from the db
 | 
			
		||||
    const connection = await DB.pool.getConnection();
 | 
			
		||||
    const [existingPools] = await connection.query<any>({ sql: 'SELECT * FROM pools;', timeout: 120000 });
 | 
			
		||||
    let existingPools: any[] = [];
 | 
			
		||||
    try {
 | 
			
		||||
      existingPools = await connection.query<any>({ sql: 'SELECT * FROM pools;', timeout: 120000 });
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      logger.err('Unable to get existing pools from the database, skipping pools.json import');
 | 
			
		||||
      connection.release();
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Finally, we generate the final consolidated pools data
 | 
			
		||||
    const finalPoolDataAdd: Pool[] = [];
 | 
			
		||||
@ -158,6 +165,8 @@ class PoolsParser {
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      logger.err('Unable to insert "Unknown" mining pool');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    connection.release();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user