@rpcbase/server 0.285.0 → 0.287.0
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/database.js +0 -2
- package/package.json +7 -7
- package/store/index.js +30 -0
package/database.js
CHANGED
|
@@ -52,8 +52,6 @@ module.exports = async(...database_names) => {
|
|
|
52
52
|
console.log("connect mongo_url", mongo_url)
|
|
53
53
|
|
|
54
54
|
const connect_opts = {
|
|
55
|
-
keepAlive: true,
|
|
56
|
-
keepAliveInitialDelay: 5000,
|
|
57
55
|
minPoolSize: 2,
|
|
58
56
|
// maxPoolSize: 1024 * 1024,
|
|
59
57
|
// TODO: setting this to a low value adds ~3s delay to requests... WHY
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.287.0",
|
|
4
4
|
"license": "SSPL-1.0",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"@rpcbase/access-control": "0.30.0",
|
|
14
14
|
"@rpcbase/agent": "0.35.0",
|
|
15
15
|
"@rpcbase/std": "0.13.0",
|
|
16
|
-
"@sentry/node": "7.
|
|
16
|
+
"@sentry/node": "7.81.1",
|
|
17
17
|
"bluebird": "3.7.2",
|
|
18
18
|
"body-parser": "1.20.2",
|
|
19
|
-
"bull": "4.11.
|
|
19
|
+
"bull": "4.11.5",
|
|
20
20
|
"connect-redis": "7.1.0",
|
|
21
21
|
"cors": "2.8.5",
|
|
22
22
|
"debug": "4.3.4",
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"expect": "29.7.0",
|
|
25
25
|
"express": "4.18.2",
|
|
26
26
|
"express-session": "1.17.3",
|
|
27
|
-
"firebase-admin": "11.11.
|
|
27
|
+
"firebase-admin": "11.11.1",
|
|
28
28
|
"glob": "9.3.5",
|
|
29
29
|
"lodash": "4.17.21",
|
|
30
30
|
"mkdirp": "2.1.3",
|
|
31
|
-
"mongoose": "
|
|
31
|
+
"mongoose": "8.0.1",
|
|
32
32
|
"nodemon": "3.0.1",
|
|
33
33
|
"picocolors": "1.0.0",
|
|
34
|
-
"postmark": "3.
|
|
35
|
-
"redis": "4.6.
|
|
34
|
+
"postmark": "3.11.0",
|
|
35
|
+
"redis": "4.6.11",
|
|
36
36
|
"request-ip": "3.3.0",
|
|
37
37
|
"sift": "17.0.1",
|
|
38
38
|
"socket.io": "4.7.2",
|
package/store/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
const {createClient} = require("redis")
|
|
3
|
+
|
|
4
|
+
const is_docker = require("@rpcbase/std/is_docker")
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const {SERVER_STORE_PORT} = process.env
|
|
8
|
+
|
|
9
|
+
const hostname = is_docker() ? "server-store" : "127.0.0.1"
|
|
10
|
+
|
|
11
|
+
const server_store_url = `redis://${hostname}:${SERVER_STORE_PORT}`
|
|
12
|
+
console.log("server_store_url", server_store_url)
|
|
13
|
+
|
|
14
|
+
let client
|
|
15
|
+
|
|
16
|
+
const get_client = async() => {
|
|
17
|
+
if (!client) {
|
|
18
|
+
client = createClient({
|
|
19
|
+
url: server_store_url,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
client.on("error", (error) => console.error("server-store:redis error:", error))
|
|
23
|
+
|
|
24
|
+
await client.connect()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return client
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = {get_client}
|