Skip to content

Commit

Permalink
feat: 命令行添加参数-c, --concurrency,用于设置并发数量,默认为5个
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Dec 3, 2017
1 parent 431ac9c commit 292d0f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class App extends EventEmitter {
this.emit(EVENT_ON_ERROR, err);
}
},
{ concurrency: 5 }
{ concurrency: this.options.concurrency }
);
} catch (err) {
this.emit(EVENT_ON_ERROR, err);
Expand Down
4 changes: 3 additions & 1 deletion bin/boomer
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ program
.option('-f, --forever', '永久运行,默认只运行一次', program.BOOLEAN, false)
.option('--dev', '以开发者模式运行,则显示浏览器运行过程', program.BOOLEAN, false)
.option('--launch <provider>', '如果是开发模式,则指定站点名称<provider>', program.STRING, '')
.option('-c, --concurrency <number>', '设置并发数量', program.INT, 5)
.action((argv, opts) => {
const app = boomer(argv.phone || process.env.PHONE || '13800000000', {
once: !opts.forever,
isProduction: !opts.dev,
launchProvider: opts.launch
launchProvider: opts.launch,
concurrency: opts.concurrency
});

app
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const defaultOptions = {
},
password: 'abc123abc123',
phone: '13000000000', // do not set default phone number
once: isProduction === false
once: isProduction === false,
concurrency: 5
};

module.exports = function(phoneNumber, options) {
Expand Down

0 comments on commit 292d0f2

Please sign in to comment.