How to use the promise-queue.configure function in promise-queue

To help you get started, we’ve selected a few promise-queue 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 robertklep / nefit-easy-core / lib / index.js View on Github external
'use strict';
const Promise    = require('bluebird');
const Queue      = require('promise-queue'); Queue.configure(Promise);
const debug      = require('debug')('nefit-easy-core');
const rawDebug   = require('debug')('nefit-easy-core:raw');
const HTTPParser = require('http-string-parser');
const XMPPClient = require('node-xmpp-client');
const Stanza     = XMPPClient.Stanza;
const Encryption = require('./encryption');
const SCRAM      = require('./scram-auth-mechanism');

// Default options for XMPP
const DEFAULT_OPTIONS = {
  host           : 'wa2-mz36-qrmzh6.bosch.de',
  saslMechanism  : 'SCRAM-SHA-1',
  pingInterval   : 30 * 1000,
  maxRetries     : 15,
  retryTimeout   : 2000,
};
github mattgodbolt / compiler-explorer / lib / compilation-env.js View on Github external
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

const
    Queue = require('promise-queue'),
    child_process = require('child_process'),
    FromConfig = require('./cache/from-config'),
    BaseCache = require('./cache/base'),
    logger = require('./logger').logger,
    _ = require('underscore'),
    fs = require('fs-extra'),
    Sentry = require('@sentry/node');

Queue.configure(Promise);

class CompilationEnvironment {
    constructor(compilerProps, doCache) {
        this.ceProps = compilerProps.ceProps;
        this.compilerProps = compilerProps.get.bind(compilerProps);
        this.okOptions = new RegExp(this.ceProps('optionsWhitelistRe', '.*'));
        this.badOptions = new RegExp(this.ceProps('optionsBlacklistRe', '(?!)'));
        this.cache = FromConfig.create(doCache === undefined || doCache ? this.ceProps('cacheConfig', '') : "");
        this.executableCache = FromConfig.create(
            doCache === undefined || doCache ? this.ceProps('executableCacheConfig', '') : "");
        this.compilerCache = FromConfig.create(
            doCache === undefined || doCache ? this.ceProps('compilerCacheConfig', '') : "");
        this.compileQueue = new Queue(this.ceProps("maxConcurrentCompiles", 1), Infinity);
        this.reportCacheEvery = this.ceProps("cacheReportEvery", 100);
        this.multiarch = null;
        try {
github serverless / serverless / lib / plugins / aws / provider / awsProvider.js View on Github external
const chalk = require('chalk');
const _ = require('lodash');
const userStats = require('../../../utils/userStats');
const naming = require('../lib/naming.js');
const https = require('https');
const fs = require('fs');
const objectHash = require('object-hash');
const PromiseQueue = require('promise-queue');
const getS3EndpointForRegion = require('../utils/getS3EndpointForRegion');
const readline = require('readline');

const constants = {
  providerName: 'aws',
};

PromiseQueue.configure(BbPromise.Promise);

const impl = {
  /**
   * Determine whether the given credentials are valid.  It turned out that detecting invalid
   * credentials was more difficult than detecting the positive cases we know about.  Hooray for
   * whak-a-mole!
   * @param credentials The credentials to test for validity
   * @return {boolean} Whether the given credentials were valid
   */
  validCredentials: credentials => {
    let result = false;
    if (credentials) {
      if (
        // valid credentials loaded
        (credentials.accessKeyId &&
          credentials.accessKeyId !== 'undefined' &&
github box / box-node-sdk / lib / util / paging-iterator.js View on Github external
* @callback IteratorCallback
 * @param {?Error} err - An error if the iterator encountered one
 * @param {IteratorData} [data] - New data from the iterator
 * @returns {void}
 */

// -----------------------------------------------------------------------------
// Requirements
// -----------------------------------------------------------------------------

var querystring = require('querystring'),
	Promise = require('bluebird'),
	PromiseQueue = require('promise-queue'),
	errors = require('./errors');

PromiseQueue.configure(Promise);

// -----------------------------------------------------------------------------
// Private
// -----------------------------------------------------------------------------

const PAGING_MODES = Object.freeze({
	MARKER: 'marker',
	OFFSET: 'offset'
});

// -----------------------------------------------------------------------------
// Public
// -----------------------------------------------------------------------------

/**
 * Asynchronous iterator for paged collections
github grafana / github-to-es / app.js View on Github external
var Queue = require('promise-queue');
var program = require('commander');
var RepoSync = require('./reposync');
var db = require('./db');

// set promise
Queue.configure(require('bluebird'));

var queue = new Queue(1, 1000);

function startRepoSync() {
  const config = require('./config.json');

  for (let repoSyncOptions of config.repos) {
    const rs = new RepoSync(repoSyncOptions, queue);
    rs.start();
  }
}

program
  .version('0.0.1')
  .command('start')
  .action(startRepoSync);
github inventid / gennie / index.js View on Github external
var Nightmare  = require('nightmare'),
    Promise    = require('bluebird'),
    Queue      = require('promise-queue'),
    express    = require('express'),
    bodyParser = require('body-parser'),
    uuid       = require('node-uuid'),
    fs         = require('fs'),
    config     = require('./config.json');

// Set promise-queue to use
// bluebird's promises.
Queue.configure(Promise);

var port        = process.env.PORT || config.port,
    timeout     = process.env.TIMEOUT || config.timeout,
    concurrency = process.env.CONCURRENCY || config.concurrency,
    nightmares  = Array(concurrency).fill().map(function() { return Nightmare(); }),
    queue       = new Queue(concurrency, Infinity),
    server      = express();

// Create the rendering engine for a new render call
function render(data) {
  var id        = uuid.v4(),
      output    = '/tmp/' + id + '.pdf',
      router    = express.Router(),
      nightmare = nightmares.pop(), // Get ourselves a nightmare worker
      deferred;
github daGrevis / msks / src / bot / src / index.js View on Github external
const _ = require('lodash')
const Promise = require('bluebird')
const Queue = require('promise-queue')

const { client } = require('./irc')
const events = require('./events')

Queue.configure(Promise)

const eventQueue = new Queue(1, Infinity)

const eventMap = {
  debug: events.onDebug,
  close: events.onClose,
  connecting: events.onConnecting,
  reconnecting: events.onReconnecting,
  registered: events.onRegistered,
  join: events.onJoin,
  quit: events.onQuit,
  part: events.onPart,
  kick: events.onKick,
  nick: events.onNick,
  userlist: events.onUserList,
  mode: events.onMode,
github gameclosure / devkit-core / src / build / streams / image-compress.js View on Github external
var path = require('path');
var chalk = require('chalk');
var tempfile = require('tempfile');
var Promise = require('bluebird');
var spawn = require('child_process').spawn;
var Queue = require('promise-queue');
var FilterStream = require('streamfilter');
var fs = require('../util/fs');
var DiskCache = require('../DiskCache');
Queue.configure(Promise);

var exec = Promise.promisify(require('child_process').exec);

var COMPRESS_EXTS = {
  '.png': true,
  '.jpg': true,
  '.gif': true
};

var CACHE_FILENAME = 'image-compress';

var loggedWarning = false;

exports.create = function (api, app, config) {
  var logger = api.logging.get('image-compress');
github Musicoin / desktop / hub / account-history.js View on Github external
var Promise = require('bluebird');
var fs = require('fs');
var os = require('os');
var mkdirp = require('mkdirp');
var jsonio = require('./json-io.js');
var lineReader = require('reverse-line-reader');
var Queue = require('promise-queue');
Queue.configure(Promise);

function AccountHistory(account, web3Connector, onChange) {
  this.web3Connector = web3Connector;
  this.onChange = onChange || function() {};
  this.web3 = web3Connector.getWeb3();
  this.account = account;
  this.workAbi = web3Connector.getWorkAbi();
  this.licenseAbi = web3Connector.getLicenseAbi();
  this.loggerAbi = web3Connector.getLoggerAbi();
  this.loggerAddress = web3Connector.getLoggerAddress();
  this.indexDir = os.homedir() + "/.musicoin/accounts/" + account + "/";
  this.indexName = this.indexDir + "history-status.json";
  this.logName = this.indexDir + "transactions.json";
  this.eventFilter = {stopWatching: function(){}};
  this.historyIndex = { lastBlock: 0 };
  this.queue = new Queue(1, Infinity);

promise-queue

Promise-based queue

MIT
Latest version published 8 years ago

Package Health Score

65 / 100
Full package analysis

Similar packages