oh god help
This commit is contained in:
		
							parent
							
								
									5281cb1fd7
								
							
						
					
					
						commit
						b098499c67
					
				
					 2 changed files with 25 additions and 19 deletions
				
			
		| 
						 | 
					@ -32,5 +32,7 @@ export default async (client) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ready = true;
 | 
					  ready = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  process.send("ready");
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  logger.log("info", "Started esmBot.");
 | 
					  logger.log("info", "Started esmBot.");
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -223,23 +223,27 @@ function calcShards(shards, procs) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  const shardArrays = calcShards(shardArray, procAmount);
 | 
					  const shardArrays = calcShards(shardArray, procAmount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for (let i = 0; i < shardArrays.length; i++) {
 | 
				
			||||||
    pm2.start({
 | 
					    pm2.start({
 | 
				
			||||||
      name: "esmBot",
 | 
					      name: "esmBot",
 | 
				
			||||||
      script: "app.js",
 | 
					      script: "app.js",
 | 
				
			||||||
      autorestart: true,
 | 
					      autorestart: true,
 | 
				
			||||||
      exp_backoff_restart_delay: 1000,
 | 
					      exp_backoff_restart_delay: 1000,
 | 
				
			||||||
 | 
					      wait_ready: true,
 | 
				
			||||||
 | 
					      listen_timeout: 60000,
 | 
				
			||||||
      watch: false,
 | 
					      watch: false,
 | 
				
			||||||
      exec_mode: "cluster",
 | 
					      exec_mode: "cluster",
 | 
				
			||||||
    instances: shardArrays.length,
 | 
					      instances: 1,
 | 
				
			||||||
      env: {
 | 
					      env: {
 | 
				
			||||||
        "SHARDS": JSON.stringify(shardArrays)
 | 
					        "SHARDS": JSON.stringify(shardArrays)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }, (err) => {
 | 
					    }, (err) => {
 | 
				
			||||||
      if (err) {
 | 
					      if (err) {
 | 
				
			||||||
      logger.error(`Failed to start esmBot: ${err}`);
 | 
					        logger.error(`Failed to start esmBot process ${i}: ${err}`);
 | 
				
			||||||
        process.exit(0);
 | 
					        process.exit(0);
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
      logger.info("Started esmBot processes.");
 | 
					        logger.info(`Started esmBot process ${i}.`);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
})();
 | 
					})();
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue