@anjianshi/utils 2.4.2 → 2.4.4

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.
@@ -1,6 +1,6 @@
1
1
  import { type Logger } from '../logging/index.js';
2
2
  /** 返回 false 可结束任务 */
3
- export type TaskExecutor<Context> = (context: Context) => Promise<undefined | false>;
3
+ export type TaskExecutor<Context> = (context: Context, logger: Logger) => Promise<void> | Promise<undefined | false>;
4
4
  /**
5
5
  * 执行定期任务
6
6
  */
@@ -20,7 +20,7 @@ export class TaskManager {
20
20
  logger.info(`#${id} 任务开始`);
21
21
  try {
22
22
  const context = this.getContext(name);
23
- const result = await executor(context);
23
+ const result = await executor(context, logger);
24
24
  const cost = (Date.now() - start) / 1000;
25
25
  logger.info(`#${id} 任务完成,耗时 ${cost}s`);
26
26
  if (result === false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anjianshi/utils",
3
- "version": "2.4.2",
3
+ "version": "2.4.4",
4
4
  "description": "Common JavaScript Utils",
5
5
  "homepage": "https://github.com/anjianshi/js-packages/utils",
6
6
  "bugs": {
@@ -28,10 +28,10 @@
28
28
  "typescript": "^5.6.3",
29
29
  "vconsole": "^3.15.1",
30
30
  "@anjianshi/presets-eslint-node": "4.0.8",
31
- "@anjianshi/presets-eslint-typescript": "5.0.5",
32
31
  "@anjianshi/presets-eslint-react": "4.0.7",
33
- "@anjianshi/presets-prettier": "3.0.1",
34
- "@anjianshi/presets-typescript": "3.2.2"
32
+ "@anjianshi/presets-eslint-typescript": "5.0.5",
33
+ "@anjianshi/presets-typescript": "3.2.2",
34
+ "@anjianshi/presets-prettier": "3.0.1"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@emotion/react": "^11.13.3",