How to use the p-forever.end function in p-forever

To help you get started, we’ve selected a few p-forever 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 roblav96 / robinhood.tools / src / server / services / symbols.service.ts View on Github external
let coms = [] as Redis.Coms
		let dids = {} as Dict
		let scoms = new redis.SetsComs(rkeys.RH.SYMBOLS)
		results.forEach(function(v) {
			dids[v.id] = v.symbol
			scoms.sadd(v.symbol)
			v.mic = _.compact(v.market.split('/')).pop()
			v.acronym = robinhood.MICS[v.mic]
			v.alive = v.state == 'active' && v.tradability == 'tradable' && v.tradeable == true
			coms.push(['hmset', `${rkeys.RH.INSTRUMENTS}:${v.symbol}`, v as any])
		})
		coms.push(['hmset', rkeys.RH.IDS, dids as any])
		scoms.merge(coms)
		await redis.main.coms(coms)
		return next || pForever.end

	}, 'https://api.robinhood.com/instruments/')
	console.info('syncInstruments -> done')
github geut / discovery-swarm-webrtc / lib / scheduler.js View on Github external
pForever(async () => {
      try {
        if (this._destroyed) return pForever.end

        this._delayedPromise = delay(ms)

        await this._delayedPromise

        if (this._destroyed) return pForever.end

        const newMS = await this._job(this)

        if (Number.isInteger(newMS)) {
          ms = newMS
        } else {
          ms = this._ms
        }
      } catch (err) {
        console.warn(`Error in Task ${this._id}`, err.message)
      }
    }).finally(() => {
      this.emit('destroy')
github roblav96 / robinhood.tools / src / server / stocks / instruments.ts View on Github external
if (process.env.DEVELOPMENT) {
			console.log('syncInstruments ->', response.results.length, response.next)
		}

		let coms = [] as Redis.Coms
		let symbols = new redis.SetsComs(rkeys.RH.SYMBOLS)
		response.results.forEach(function(v) {
			symbols.sadd(v.symbol)
			v.mic = _.compact(v.market.split('/')).pop()
			v.acronym = robinhood.MICS[v.mic]
			v.alive = v.state == 'active' && v.tradability == 'tradable' && v.tradeable == true
			coms.push(['hmset', `${rkeys.RH.INSTRUMENTS}:${v.symbol}`, v as any])
		})
		symbols.merge(coms)
		await redis.main.coms(coms)
		return response.next || pForever.end

	}, 'https://api.robinhood.com/instruments/')
github iopipe / sqs-to-lambda-async / src / index.js View on Github external
return pForever(previousVal => {
    handleLambdaCallback(kwargs, previousVal);
    readerIndex++;
    return readerIndex < kwargs.NumberOfRuns
      ? receiveMessages(kwargs)
      : pForever.end;
  }, []);
}
github roblav96 / robinhood.tools / src / server / watchers / rh.instruments.watchers.ts View on Github external
await pforever(function(url) {
		if (url) return onUrl(url);
		return pforever.end
	}, 'https://api.robinhood.com/instruments/')
}
github roblav96 / robinhood.tools / src / server / adapters / robinhood.ts View on Github external
await pForever(async url => {
		config.url = url
		let { results, next } = await http.request(config) as Robinhood.Api.Paginated
		results.forEach(v => {
			core.fix(v, true)
			items.push(v)
		})
		return next || pForever.end
	}, config.url)
	return items

p-forever

Run promise-returning & async functions repeatedly until you end it

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Popular p-forever functions