@jayfong/x-server 1.32.1 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.33.0](https://github.com/jfWorks/x-server/compare/v1.32.1...v1.33.0) (2022-06-11)
6
+
7
+
8
+ ### Features
9
+
10
+ * defineTask concurrency ([d8174aa](https://github.com/jfWorks/x-server/commit/d8174aa302e9013610d41265d937512a02412359))
11
+
5
12
  ### [1.32.1](https://github.com/jfWorks/x-server/compare/v1.32.0...v1.32.1) (2022-06-02)
6
13
 
7
14
 
@@ -18,7 +18,7 @@ function defineTask(options) {
18
18
  },
19
19
  prefix: `${_x.x.appId}_task`
20
20
  });
21
- queue.process(async job => {
21
+ queue.process(options.concurrency || 1, async job => {
22
22
  return options.handle(job.data);
23
23
  });
24
24
  return queue;
@@ -9,7 +9,7 @@ export function defineTask(options) {
9
9
  },
10
10
  prefix: `${x.appId}_task`
11
11
  });
12
- queue.process(async job => {
12
+ queue.process(options.concurrency || 1, async job => {
13
13
  return options.handle(job.data);
14
14
  });
15
15
  return queue;
@@ -139,6 +139,12 @@ export declare namespace XTask {
139
139
  * 任务名称
140
140
  */
141
141
  name: string;
142
+ /**
143
+ * 并发数量
144
+ *
145
+ * @default 1
146
+ */
147
+ concurrency?: number;
142
148
  /**
143
149
  * 处理器
144
150
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "1.32.1",
3
+ "version": "1.33.0",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",