How to use service-runner - 4 common examples

To help you get started, we’ve selected a few service-runner examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikimedia / parsoid / lib / config / ParsoidConfig.js View on Github external
}, this);
	this._uniq = 0;

	// Don't freak out!
	// This happily overwrites inherited properties.
	Object.assign(this, options);
	// Trace, debug, and dump flags should be sets, but options might
	// include them as arrays.
	['traceFlags', 'debugFlags', 'dumpFlags'].forEach(function(f) {
		if (Array.isArray(this[f])) {
			this[f] = new Set(this[f]);
		}
	}, this);

	if (options.parent && (!this.loggerBackend || !this.metrics)) {
		var srlogger = ServiceRunner.getLogger(options.parent.logging);
		if (!this.loggerBackend) {
			this.loggerBackend = function(logData, cb) {
				srlogger.log(logData.logType, prepareLog(logData));
				cb();
			};
		}
		if (!this.metrics) {
			this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
		}
	}

	if (!localSettings && options.localsettings) {
		localSettings = require(options.localsettings);
	}

	if (localSettings && localSettings.setup) {
github wikimedia / parsoid / lib / config / ParsoidConfig.js View on Github external
function ParsoidConfig(localSettings, options) {
	options = options || {};

	this.mwApiMap = new Map();
	this.reverseMwApiMap = new Map();
	Object.keys(CONFIG_DEFAULTS).forEach(function(k) {
		this[k] = Util.clone(CONFIG_DEFAULTS[k]);
	}, this);
	this._uniq = 0;

	// Don't freak out!
	// This happily overwrites inherited properties.
	Object.assign(this, options);

	if (options.parent && (!this.loggerBackend || !this.metrics)) {
		var srlogger = ServiceRunner.getLogger(options.parent.logging);
		if (!this.loggerBackend) {
			this.loggerBackend = function(logData, cb) {
				srlogger.log(logData.logType, prepareLog(logData));
				cb();
			};
		}
		if (!this.metrics) {
			this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
		}
	}

	if (!localSettings && options.localsettings) {
		localSettings = require(options.localsettings);
	}

	if (localSettings && localSettings.setup) {
github wikimedia / parsoid / lib / config / ParsoidConfig.js View on Github external
this._uniq = 0;

	// Don't freak out!
	// This happily overwrites inherited properties.
	Object.assign(this, options);

	if (options.parent && (!this.loggerBackend || !this.metrics)) {
		var srlogger = ServiceRunner.getLogger(options.parent.logging);
		if (!this.loggerBackend) {
			this.loggerBackend = function(logData, cb) {
				srlogger.log(logData.logType, prepareLog(logData));
				cb();
			};
		}
		if (!this.metrics) {
			this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
		}
	}

	if (!localSettings && options.localsettings) {
		localSettings = require(options.localsettings);
	}

	if (localSettings && localSettings.setup) {
		localSettings.setup(this);
	}

	// Call setMwApi for each specified API.
	if (Array.isArray(this.mwApis)) {
		this.mwApis.forEach(function(api) {
			this.setMwApi(api);
		}, this);
github wikimedia / parsoid / lib / config / ParsoidConfig.js View on Github external
['traceFlags', 'debugFlags', 'dumpFlags'].forEach(function(f) {
		if (Array.isArray(this[f])) {
			this[f] = new Set(this[f]);
		}
	}, this);

	if (options.parent && (!this.loggerBackend || !this.metrics)) {
		var srlogger = ServiceRunner.getLogger(options.parent.logging);
		if (!this.loggerBackend) {
			this.loggerBackend = function(logData, cb) {
				srlogger.log(logData.logType, prepareLog(logData));
				cb();
			};
		}
		if (!this.metrics) {
			this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
		}
	}

	if (!localSettings && options.localsettings) {
		localSettings = require(options.localsettings);
	}

	if (localSettings && localSettings.setup) {
		localSettings.setup(this);
	}

	// Call setMwApi for each specified API.
	if (Array.isArray(this.mwApis)) {
		this.mwApis.forEach(function(api) {
			this.setMwApi(api);
		}, this);

service-runner

Generic nodejs service supervisor / cluster runner

Apache-2.0
Latest version published 2 months ago

Package Health Score

73 / 100
Full package analysis

Popular service-runner functions