How to use the kew.delay function in kew

To help you get started, we’ve selected a few kew 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 Medium / zcache / test / test_CachePair.js View on Github external
.then(function (data) {
      test.equal('value', data, 'The get() should return the right value from the secondary instance')
      test.equals(1, cache2.getRequestCounts()['get'], 'The secondary cache should get one get()')

      // the following is a fragile test... any better ideas?
      return Q.delay(20)
    })
    .then(function () {
github volumio / Volumio2 / app / plugins / music_service / music_library / index.js View on Github external
function onScanFinished() {
		// remove all records which are not found during scan
		var scanPath = self.scanPath;
		self.scanPath = null;
		self.logger.info('MusicLibrary: remove all unaffected items at ' + scanPath);

		// wait for debounceTime, so we make sure all records are saved/updated
		return libQ.delay(config.debounceTime * 2).then(function() { // we multiply by 2 to make sure cache is processed
			return self.model.AudioMetadata.destroy({
				where: {
					[Sequelize.Op.and]: {
						// It's not clear, but 'endsWith' produce "LIKE 'hat%'" condition
						// http://docs.sequelizejs.com/manual/querying.html#operators
						location: {[Sequelize.Op.endsWith]: scanPath + path.sep},
						updatedAt: {[Sequelize.Op.lt]: self.scanStartedAt}
					}
				}
			});
		}).then(function(numDeleted) {
			self.logger.info('MusicLibrary: removed all unaffected items:', numDeleted);
			return self.backupDatabase();
		});
	}
github Medium / zcache / lib / FakeCache.js View on Github external
FakeCache.prototype.get = function (key) {
  if (this._failureCount > 0) return this._fakeFail('get')
  this._logger.fine('FakeCache - get', key)

  var self = this
  // Add an artificial delay to mimic real world cache latency.
  return Q.delay(this._latencyMs)
    .then(function actualGet() {
      self._requestCounts.get += 1
      return Q.resolve(self._getInternal(key))
    })
}
github Medium / shepherd / test / importantDeps.js View on Github external
this.graph.add('throws-first', function () {
    test.ok("First important node ran")
    failCount++
    return Q.delay(500)
      .then(function () {
        throw err
      })
  })
github Medium / shepherd / test / profiling.js View on Github external
function testDelay(delayMs) {
    return Q.delay(true, delayMs)
  }
github Medium / zcache / test / test_RedisConnection.js View on Github external
.then(function () {

        return Q.delay(1050)
      })
      .then(function (val) {

kew

a lightweight promise library for node

Apache-2.0
Latest version published 9 years ago

Package Health Score

59 / 100
Full package analysis