@qingfu/core-env 0.5.4 → 0.5.5
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 +1 -1
- package/lib/broker.js +1 -0
- package/lib/queue.js +0 -28
- package/package.json +11 -12
package/index.js
CHANGED
|
@@ -25,7 +25,7 @@ exports.start = async function() {
|
|
|
25
25
|
|
|
26
26
|
exports.stop = async function( code = 0 ) {
|
|
27
27
|
try {
|
|
28
|
-
setTimeout(() => process.exit( 1 ),
|
|
28
|
+
setTimeout(() => process.exit( 1 ), 30 * 1000 );
|
|
29
29
|
for ( let bundle of bundles.reverse() )
|
|
30
30
|
if ( bundle.stopPromise )
|
|
31
31
|
await bundle.stopPromise();
|
package/lib/broker.js
CHANGED
|
@@ -14,6 +14,7 @@ if ( process.env.BROKER_URI ) {
|
|
|
14
14
|
skipProcessEventRegistration: true,
|
|
15
15
|
namespace: ns, transporter,
|
|
16
16
|
serializer: 'Notepack',
|
|
17
|
+
tracking: { enabled: true, shutdownTimeout: 30 * 1000 },
|
|
17
18
|
requestTimeout: process.env.BROKER_TIMEOUT || 10 * 1000,
|
|
18
19
|
cacher: { type: 'Memory', options: { ttl: 30, clone: true }},
|
|
19
20
|
logger: { type: 'Console', options: { level: 'error', formatter: 'short' }},
|
package/lib/queue.js
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
if ( process.env.QUEUE_URI ) {
|
|
2
|
-
|
|
3
|
-
const Bull = require( 'bull' );
|
|
4
|
-
const list = [];
|
|
5
|
-
const defaults = { defaultJobOptions: { removeOnComplete: true, removeOnFail: true }};
|
|
6
|
-
|
|
7
|
-
global.Queue = module.exports = ( name, options ) => {
|
|
8
|
-
let queue = new Bull( name, process.env.QUEUE_URI, _.defaultsDeep( options, defaults ));
|
|
9
|
-
queue.on( 'error', err => {
|
|
10
|
-
logger.error( err, { queue: name });
|
|
11
|
-
});
|
|
12
|
-
queue.on( 'failed', ( job, err ) => {
|
|
13
|
-
logger.error( err, { queue: name, data: job.data });
|
|
14
|
-
});
|
|
15
|
-
queue.close = _.wrap( queue.close, function( func, ...args ) {
|
|
16
|
-
_.pull( list, this );
|
|
17
|
-
return func.apply( this, args );
|
|
18
|
-
});
|
|
19
|
-
list.push( queue );
|
|
20
|
-
return queue;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
Queue.stopPromise = () => {
|
|
24
|
-
return Promise.all( list.map( v => v.close() ));
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
1
|
if ( process.env.BULLMQ_URI ) {
|
|
30
2
|
|
|
31
3
|
const { Queue, Worker } = require( 'bullmq' );
|
package/package.json
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qingfu/core-env",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"readmeFilename": "README.md",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@koa/cors": "5.0.0",
|
|
7
7
|
"@koa/router": "13.1.0",
|
|
8
8
|
"base-x": "5.0.0",
|
|
9
|
-
"
|
|
10
|
-
"bullmq": "5.13.1",
|
|
9
|
+
"bullmq": "5.34.8",
|
|
11
10
|
"busboy": "1.6.0",
|
|
12
|
-
"cookie": "0.
|
|
11
|
+
"cookie": "1.0.2",
|
|
13
12
|
"dotenv-extended": "2.9.0",
|
|
14
13
|
"glob": "8.1.0",
|
|
15
|
-
"ioredis": "5.4.
|
|
14
|
+
"ioredis": "5.4.2",
|
|
16
15
|
"jsonwebtoken": "9.0.2",
|
|
17
16
|
"koa": "2.15.3",
|
|
18
17
|
"koa-bodyparser": "4.4.1",
|
|
19
18
|
"koa-favicon": "2.1.0",
|
|
20
|
-
"koa-helmet": "
|
|
19
|
+
"koa-helmet": "8.0.1",
|
|
21
20
|
"koa-logger": "3.2.1",
|
|
22
21
|
"koa-methodoverride": "2.0.0",
|
|
23
22
|
"koa-qs": "3.0.0",
|
|
24
23
|
"lodash": "4.17.21",
|
|
25
|
-
"moleculer": "0.14.
|
|
26
|
-
"mongoose": "7.8.
|
|
24
|
+
"moleculer": "0.14.35",
|
|
25
|
+
"mongoose": "7.8.3",
|
|
27
26
|
"mongoose-cast-aggregation": "0.3.1",
|
|
28
27
|
"mongoose-geojson-schema": "2.2.5",
|
|
29
28
|
"mongoose-lean-defaults": "2.2.1",
|
|
30
29
|
"mongoose-lean-getters": "2.1.1",
|
|
31
|
-
"mongoose-lean-virtuals": "1.
|
|
30
|
+
"mongoose-lean-virtuals": "1.1.0",
|
|
32
31
|
"ms": "2.1.3",
|
|
33
32
|
"notepack.io": "3.0.1",
|
|
34
33
|
"pinyin": "3.1.0",
|
|
@@ -36,10 +35,10 @@
|
|
|
36
35
|
"primus-rooms": "3.4.3",
|
|
37
36
|
"qr-image": "3.2.0",
|
|
38
37
|
"serialize-error": "8.1.0",
|
|
39
|
-
"superagent": "10.1.
|
|
38
|
+
"superagent": "10.1.1",
|
|
40
39
|
"wechat-encrypt": "1.1.1",
|
|
41
|
-
"winston": "3.
|
|
42
|
-
"winston-mongodb": "
|
|
40
|
+
"winston": "3.17.0",
|
|
41
|
+
"winston-mongodb": "6.0.0",
|
|
43
42
|
"xlsx": "0.18.5",
|
|
44
43
|
"xml2js": "0.6.2"
|
|
45
44
|
}
|