@kne/fastify-task 0.1.0-alpha.2 → 0.1.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.
package/index.js CHANGED
@@ -11,7 +11,7 @@ module.exports = fp(
11
11
  name: 'task',
12
12
  limit: 10,
13
13
  dir: path.resolve(process.cwd(), 'libs', 'tasks'),
14
- syncCron: '*/10 * * * *',
14
+ cronTime: '*/10 * * * *',
15
15
  scriptName: 'index',
16
16
  maxPollTimes: 100,
17
17
  pollInterval: 5000,
@@ -45,9 +45,9 @@ module.exports = fp(
45
45
 
46
46
  fastify.register(
47
47
  require('fastify-plugin')(async fastify => {
48
- if (options.syncCron) {
48
+ if (options.cronTime) {
49
49
  fastify.cron.createJob({
50
- cronTime: options.syncCron,
50
+ cronTime: options.cronTime,
51
51
  onTick: async () => {
52
52
  const { runner } = fastify[options.name].services;
53
53
  await runner();
@@ -85,14 +85,14 @@ module.exports = fp(async (fastify, options) => {
85
85
  status: 'success',
86
86
  output: result,
87
87
  progress: 100,
88
- completeAt: new Date()
88
+ completedAt: new Date()
89
89
  });
90
90
  })
91
91
  .catch(error => {
92
92
  return task.update({
93
93
  status: 'failed',
94
94
  error: error.toString(),
95
- completeAt: new Date()
95
+ completedAt: new Date()
96
96
  });
97
97
  });
98
98
  };
@@ -141,7 +141,7 @@ module.exports = fp(async (fastify, options) => {
141
141
  const task = await detail({ id });
142
142
  await task.update(
143
143
  Object.assign({}, props, {
144
- completeAt: new Date(),
144
+ completedAt: new Date(),
145
145
  completedUserId: userId
146
146
  })
147
147
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kne/fastify-task",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.1",
4
4
  "description": "用于编排任务,追踪任务执行状态,结果",
5
5
  "main": "index.js",
6
6
  "scripts": {