ti2 1.0.23 → 1.0.26
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/cache.js +11 -0
- package/index.js +3 -0
- package/package.json +1 -1
- package/worker/index.js +4 -1
package/cache.js
CHANGED
|
@@ -55,8 +55,19 @@ const getOrExec = async ({
|
|
|
55
55
|
return value;
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
+
const drop = async ({
|
|
59
|
+
pluginName,
|
|
60
|
+
fn,
|
|
61
|
+
fnParams,
|
|
62
|
+
}) => {
|
|
63
|
+
let key = hash({ fn, fnParams });
|
|
64
|
+
key = `${pluginName}:${key}`;
|
|
65
|
+
await cache.del(key);
|
|
66
|
+
};
|
|
67
|
+
|
|
58
68
|
module.exports = {
|
|
59
69
|
cache,
|
|
60
70
|
save,
|
|
61
71
|
getOrExec,
|
|
72
|
+
drop,
|
|
62
73
|
};
|
package/index.js
CHANGED
|
@@ -203,6 +203,9 @@ module.exports = async ({
|
|
|
203
203
|
app.use(middleware.mock());
|
|
204
204
|
// global error Handling
|
|
205
205
|
app.use((err, req, res) => {
|
|
206
|
+
if (process.env.CONSOLE_ERRORS) {
|
|
207
|
+
console.error(err);
|
|
208
|
+
}
|
|
206
209
|
// console.log(req.headers.['X-Request-Id'], err);
|
|
207
210
|
res.status(err.status || 500);
|
|
208
211
|
if ((process.env.JEST_WORKER_ID)) {
|
package/package.json
CHANGED
package/worker/index.js
CHANGED
|
@@ -40,7 +40,10 @@ const worker = ({ plugins: pluginsParam }) => (id, disconnect) => {
|
|
|
40
40
|
return pluginsParam;
|
|
41
41
|
})();
|
|
42
42
|
const thePlugin = plugins.find(({ name }) => name === pluginName);
|
|
43
|
-
const resultValue = await thePlugin[method](
|
|
43
|
+
const resultValue = await thePlugin[method]({
|
|
44
|
+
...params,
|
|
45
|
+
plugins,
|
|
46
|
+
});
|
|
44
47
|
console.log(`job ${jobId} > completed`);
|
|
45
48
|
await saveResult({ id: jobId, resultValue });
|
|
46
49
|
});
|