Initialize queue only if queue is enabled (#4125)
This commit is contained in:
		
							parent
							
								
									baf861ac79
								
							
						
					
					
						commit
						6cd41f9860
					
				
					 1 changed files with 20 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -7,19 +7,27 @@ import { program } from '../argv';
 | 
			
		|||
 | 
			
		||||
const enableQueue = config.redis != null && !program.disableQueue;
 | 
			
		||||
 | 
			
		||||
const queue = new Queue('misskey', {
 | 
			
		||||
	redis: {
 | 
			
		||||
		port: config.redis.port,
 | 
			
		||||
		host: config.redis.host,
 | 
			
		||||
		password: config.redis.pass
 | 
			
		||||
	},
 | 
			
		||||
const queue = initializeQueue();
 | 
			
		||||
 | 
			
		||||
	removeOnSuccess: true,
 | 
			
		||||
	removeOnFailure: true,
 | 
			
		||||
	getEvents: false,
 | 
			
		||||
	sendEvents: false,
 | 
			
		||||
	storeJobs: false
 | 
			
		||||
});
 | 
			
		||||
function initializeQueue() {
 | 
			
		||||
	if (enableQueue) {
 | 
			
		||||
		return new Queue('misskey', {
 | 
			
		||||
			redis: {
 | 
			
		||||
				port: config.redis.port,
 | 
			
		||||
				host: config.redis.host,
 | 
			
		||||
				password: config.redis.pass
 | 
			
		||||
			},
 | 
			
		||||
 | 
			
		||||
			removeOnSuccess: true,
 | 
			
		||||
			removeOnFailure: true,
 | 
			
		||||
			getEvents: false,
 | 
			
		||||
			sendEvents: false,
 | 
			
		||||
			storeJobs: false
 | 
			
		||||
		});
 | 
			
		||||
	} else {
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function createHttpJob(data: any) {
 | 
			
		||||
	if (enableQueue) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue