Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit concurrent API calls #582

Merged
merged 4 commits into from
May 1, 2018
Merged

Conversation

mxstbr
Copy link
Member

@mxstbr mxstbr commented May 1, 2018

Closes #580

@mxstbr mxstbr mentioned this pull request May 1, 2018
@@ -15,6 +16,8 @@ import { RepoMetaData } from "../../dsl/BitBucketServerDSL"

export type APIToken = string

const limit = pLimit(25)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: open to different limits here, this is just a first shot in the dark. Not sure if this'll even fix the issue. 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good enough start for me

@DangerCI
Copy link

DangerCI commented May 1, 2018

New dependencies added: p-limit and @types/p-limit.

p-limit

Author: Sindre Sorhus

Description: Run multiple promise-returning & async functions with limited concurrency

Homepage: https://github.com/sindresorhus/p-limit#readme

Createdover 1 year ago
Last Updated3 months ago
LicenseMIT
Maintainers1
Releases3
Direct Dependenciesp-try
Keywordspromise, limit, limited, concurrency, throttle, throat, rate, batch, ratelimit, task, queue, async, await, promises and bluebird
README

p-limit Build Status

Run multiple promise-returning & async functions with limited concurrency

Install

$ npm install p-limit

Usage

const pLimit = require('p-limit');

const limit = pLimit(1);

const input = [
	limit(() => fetchSomething('foo')),
	limit(() => fetchSomething('bar')),
	limit(() => doSomething())
];

(async () => {
	// Only one promise is run at once
	const result = await Promise.all(input);
	console.log(result);
})();

API

pLimit(concurrency)

Returns a limit function.

concurrency

Type: number

Minimum: 1

Concurrency limit.

limit(fn)

Returns the promise returned by calling fn.

fn

Type: Function

Promise-returning/async function.

Related

  • p-queue - Promise queue with concurrency control
  • p-throttle - Throttle promise-returning & async functions
  • p-debounce - Debounce promise-returning & async functions
  • p-all - Run promise-returning & async functions concurrently with optional limited concurrency
  • More…

License

MIT © Sindre Sorhus

@types/p-limit

Author: Unknown

Description: TypeScript definitions for p-limit

Homepage: http://npmjs.com/package/@types/p-limit

Created9 months ago
Last Updated19 days ago
LicenseMIT
Maintainers1
Releases3
Direct Dependencies
README

Installation

npm install --save @types/p-limit

Summary

This package contains type definitions for p-limit (https://github.com/sindresorhus/p-limit#readme).

Details

Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/p-limit

Additional Details

  • Last updated: Wed, 24 Jan 2018 20:07:13 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by BendingBender https://github.com/BendingBender.

Generated by 🚫 dangerJS

@orta
Copy link
Member

orta commented May 1, 2018

Dang, I wonder how you can get a null pr body, danger.github.pr.body.includes("peril-debug")

Regardlesss. Yeah, this looks good 👍

@orta
Copy link
Member

orta commented May 1, 2018

Merge on green - and I'll make a release

@mxstbr
Copy link
Member Author

mxstbr commented May 1, 2018

Dang, I wonder how you can get a null pr body

Submitted PR from the command line with no body 😅

@mxstbr
Copy link
Member Author

mxstbr commented May 1, 2018

Wait does "Merge on green" only add the label automatically or also automatically merge it once CI passes? 😱

@orta
Copy link
Member

orta commented May 1, 2018

@danger danger deleted a comment from peril-staging bot May 1, 2018
@danger danger deleted a comment from peril-staging bot May 1, 2018
@mxstbr
Copy link
Member Author

mxstbr commented May 1, 2018

Damnnnnn 🔥🔥🔥🔥🔥

@peril-staging peril-staging bot merged commit 388ebc7 into danger:master May 1, 2018
@mxstbr mxstbr deleted the rate-limit-api-calls branch May 1, 2018 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants