This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Use foreground service to protect your progress being killed. | |
| use startService to start service | |
| use startForeground(NOTIFICATION_ID, notification); to prevent from desctroying. | |
| use your lib. | |
| PROFIT! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as mongoose from 'mongoose'; | |
| export let Schema = mongoose.Schema; | |
| export let ObjectId = mongoose.Schema.Types.ObjectId; | |
| export let Mixed = mongoose.Schema.Types.Mixed; | |
| export interface IHeroModel extends mongoose.Document { | |
| name: string; | |
| power: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { fork } = require('child_process'); | |
| const cache = require('node-shared-cache'); | |
| let childCache = new cache.Cache('children', 524288); | |
| let child; | |
| function startWorker(ready) { | |
| child = fork(require.resolve('./worker'), { | |
| cwd: process.cwd(), | |
| silent: true | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ClusterService = function() { | |
| var printer = new ClusterPrinterModule(); | |
| var connector = new ClusterConnectorModule(); | |
| var filter = new ClusterFilterModule(); | |
| var clusterList; | |
| var config; // fullClusterContainer filterDirectBtn filterStopsBtn filterAllBtn | |
| // clusterListContainer warningMessageBox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # clustering | |
| cluster = require "cluster" | |
| process.execPath = "coffee" | |
| os = require("os") | |
| numCPU = os.cpus().length | |
| platform = os.platform() | |
| # logger | |
| winston = require("./lib/utils/logger.coffee")("server.coffee") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Require the core node modules. | |
| var chalk = require( "chalk" ); | |
| var cluster = require( "cluster" ); | |
| var os = require( "os" ); | |
| // ----------------------------------------------------------------------------------- // | |
| // ----------------------------------------------------------------------------------- // | |
| // The cluster module in Node.js works by executing the application entry-point | |
| // multiple and sharing the master ports with the worker ports. As such, this code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * -AI- | |
| * Botใฎใใใฏใจใณใ(ๆ่ใๆ ๅฝ) | |
| * | |
| * ๅฏพ่ฉฑใจๆ่ใๅใใใญใปในใง่กใใจใๆ่ๆ้ใ้ทๅผใใใจใใซในใใชใผใ ใใ | |
| * ๅๆญใใใฆใใพใใฎใงใๅฅใ ใฎใใญใปในใง่กใใใใซใใพใ | |
| */ | |
| import Othello, { Color } from '../core'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var cluster = require('cluster'), | |
| app = require('./app'); | |
| var workers = {}, | |
| count = require('os').cpus().length; | |
| function spawn(){ | |
| var worker = cluster.fork(); | |
| workers[worker.pid] = worker; | |
| return worker; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| app.use(function(req, res, next){ | |
| if (app.get('graceful_shutdown') === true) { | |
| res.set('Connection', 'close'); | |
| } | |
| next(); | |
| }); | |
| app.set('graceful_shutdown_start', function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Require libraries | |
| var os = require("os"); | |
| var fs = require("fs"); | |
| var readline = require("readline"); | |
| var cluster = require("cluster"); | |
| var express = require("express"); | |
| var site = express(); | |
| // Var up, bro | |
| var i, read; |
NewerOlder