Fix: Don't build statistics cache when DB is disabled.
This commit is contained in:
		
							parent
							
								
									4c5ff7714e
								
							
						
					
					
						commit
						599159ecf0
					
				@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					const config = require('../mempool-config.json');
 | 
				
			||||||
import { Request, Response } from 'express';
 | 
					import { Request, Response } from 'express';
 | 
				
			||||||
import statistics from './api/statistics';
 | 
					import statistics from './api/statistics';
 | 
				
			||||||
import feeApi from './api/fee-api';
 | 
					import feeApi from './api/fee-api';
 | 
				
			||||||
@ -10,8 +11,10 @@ class Routes {
 | 
				
			|||||||
  private cache = {};
 | 
					  private cache = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor() {
 | 
					  constructor() {
 | 
				
			||||||
    this.createCache();
 | 
					    if (!config.DB_DISABLED) {
 | 
				
			||||||
    setInterval(this.createCache.bind(this), 600000);
 | 
					      this.createCache();
 | 
				
			||||||
 | 
					      setInterval(this.createCache.bind(this), 600000);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private async createCache() {
 | 
					  private async createCache() {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user