@jayfong/x-server 1.35.0 → 1.35.1

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.
@@ -54,7 +54,7 @@ function defineSliceTask(options) {
54
54
  key: key,
55
55
  redisKey: redisKey
56
56
  }, {
57
- delay: typeof options.duration === 'function' ? (0, _date.ms)(options.duration(key)) : (0, _date.ms)(options.duration)
57
+ delay: addOptions != null && addOptions.duration ? (0, _date.ms)(addOptions.duration) : typeof options.duration === 'function' ? (0, _date.ms)(options.duration(key)) : (0, _date.ms)(options.duration)
58
58
  });
59
59
  }
60
60
  }
@@ -42,7 +42,7 @@ export function defineSliceTask(options) {
42
42
  key: key,
43
43
  redisKey: redisKey
44
44
  }, {
45
- delay: typeof options.duration === 'function' ? ms(options.duration(key)) : ms(options.duration)
45
+ delay: addOptions != null && addOptions.duration ? ms(addOptions.duration) : typeof options.duration === 'function' ? ms(options.duration(key)) : ms(options.duration)
46
46
  });
47
47
  }
48
48
  }
@@ -172,11 +172,14 @@ export declare namespace XTask {
172
172
  handle: (data: T[], key: K) => any;
173
173
  }
174
174
  interface SliceTaskNoKey<T> {
175
- add: (data: T) => Promise<void>;
175
+ add: (data: T, options?: {
176
+ duration?: MsValue;
177
+ }) => Promise<void>;
176
178
  }
177
179
  interface SliceTask<T, K> {
178
180
  add: (data: T, options: {
179
181
  key: K;
182
+ duration?: MsValue;
180
183
  }) => Promise<void>;
181
184
  }
182
185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "1.35.0",
3
+ "version": "1.35.1",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",