Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion packages/api-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"@standardnotes/domain-events-infra": "workspace:*",
"@standardnotes/security": "workspace:*",
"@standardnotes/time": "workspace:*",
"axios": "^1.1.3",
"agentkeepalive": "^4.5.0",
"axios": "^1.6.1",
"cors": "2.8.5",
"dotenv": "^16.0.1",
"express": "^4.18.2",
Expand Down
17 changes: 13 additions & 4 deletions packages/api-gateway/src/Bootstrap/Container.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as winston from 'winston'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const axios = require('axios')
import { AxiosInstance } from 'axios'
import * as AgentKeepAlive from 'agentkeepalive'
import axios, { AxiosInstance } from 'axios'
import Redis from 'ioredis'
import { Container } from 'inversify'
import { Timer, TimerInterface } from '@standardnotes/time'
Expand Down Expand Up @@ -70,7 +69,17 @@ export class ContainerConfigLoader {
container.bind(TYPES.ApiGateway_Redis).toConstantValue(redis)
}

container.bind<AxiosInstance>(TYPES.ApiGateway_HTTPClient).toConstantValue(axios.create())
container.bind<AxiosInstance>(TYPES.ApiGateway_HTTPClient).toConstantValue(
axios.create({
httpAgent: new AgentKeepAlive({
keepAlive: true,
timeout: env.get('AGENT_KEEP_ALIVE_TIMEOUT', true) ? +env.get('AGENT_KEEP_ALIVE_TIMEOUT', true) : 8_000,
freeSocketTimeout: env.get('AGENT_KEEP_ALIVE_FREE_SOCKET_TIMEOUT', true)
? +env.get('AGENT_KEEP_ALIVE_FREE_SOCKET_TIMEOUT', true)
: 4_000,
}),
}),
)

// env vars
container.bind(TYPES.ApiGateway_SYNCING_SERVER_JS_URL).toConstantValue(env.get('SYNCING_SERVER_JS_URL', true))
Expand Down
4 changes: 4 additions & 0 deletions packages/auth/bin/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ void container.load().then((container) => {

const serverInstance = server.build().listen(env.get('PORT'))

const keepAliveTimeout = env.get('KEEP_ALIVE_TIMEOUT', true) ? +env.get('KEEP_ALIVE_TIMEOUT', true) : 5000

serverInstance.keepAliveTimeout = keepAliveTimeout

process.on('SIGTERM', () => {
logger.info('SIGTERM signal received: closing HTTP server')
serverInstance.close(() => {
Expand Down
4 changes: 4 additions & 0 deletions packages/files/bin/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ void container.load().then((container) => {

const serverInstance = server.build().listen(env.get('PORT'))

const keepAliveTimeout = env.get('KEEP_ALIVE_TIMEOUT', true) ? +env.get('KEEP_ALIVE_TIMEOUT', true) : 5000

serverInstance.keepAliveTimeout = keepAliveTimeout

process.on('SIGTERM', () => {
logger.info('SIGTERM signal received: closing HTTP server')
serverInstance.close(() => {
Expand Down
4 changes: 4 additions & 0 deletions packages/home-server/src/Server/HomeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ export class HomeServer implements HomeServerInterface {

const serverInstance = server.build().listen(port)

const keepAliveTimeout = env.get('KEEP_ALIVE_TIMEOUT', true) ? +env.get('KEEP_ALIVE_TIMEOUT', true) : 5000

serverInstance.keepAliveTimeout = keepAliveTimeout

this.serverInstance = serverInstance

process.on('SIGTERM', () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/revisions/bin/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ void container.load().then((container) => {

const serverInstance = server.build().listen(env.get('PORT'))

const keepAliveTimeout = env.get('KEEP_ALIVE_TIMEOUT', true) ? +env.get('KEEP_ALIVE_TIMEOUT', true) : 5000

serverInstance.keepAliveTimeout = keepAliveTimeout

process.on('SIGTERM', () => {
logger.info('SIGTERM signal received: closing HTTP server')
serverInstance.close(() => {
Expand Down
4 changes: 4 additions & 0 deletions packages/syncing-server/bin/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ void container.load().then((container) => {

const serverInstance = server.build().listen(env.get('PORT'))

const keepAliveTimeout = env.get('KEEP_ALIVE_TIMEOUT', true) ? +env.get('KEEP_ALIVE_TIMEOUT', true) : 5000

serverInstance.keepAliveTimeout = keepAliveTimeout

process.on('SIGTERM', () => {
logger.info('SIGTERM signal received: closing HTTP server')
serverInstance.close(() => {
Expand Down
4 changes: 4 additions & 0 deletions packages/websockets/bin/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ void container.load().then((container) => {

const serverInstance = server.build().listen(env.get('PORT'))

const keepAliveTimeout = env.get('KEEP_ALIVE_TIMEOUT', true) ? +env.get('KEEP_ALIVE_TIMEOUT', true) : 5000

serverInstance.keepAliveTimeout = keepAliveTimeout

process.on('SIGTERM', () => {
logger.info('SIGTERM signal received: closing HTTP server')
serverInstance.close(() => {
Expand Down
20 changes: 15 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5249,7 +5249,8 @@ __metadata:
"@types/prettyjson": "npm:^0.0.30"
"@typescript-eslint/eslint-plugin": "npm:^6.5.0"
"@typescript-eslint/parser": "npm:^6.5.0"
axios: "npm:^1.1.3"
agentkeepalive: "npm:^4.5.0"
axios: "npm:^1.6.1"
cors: "npm:2.8.5"
dotenv: "npm:^16.0.1"
eslint: "npm:^8.39.0"
Expand Down Expand Up @@ -6789,6 +6790,15 @@ __metadata:
languageName: node
linkType: hard

"agentkeepalive@npm:^4.5.0":
version: 4.5.0
resolution: "agentkeepalive@npm:4.5.0"
dependencies:
humanize-ms: "npm:^1.2.1"
checksum: dd210ba2a2e2482028f027b1156789744aadbfd773a6c9dd8e4e8001930d5af82382abe19a69240307b1d8003222ce6b0542935038313434b900e351914fc15f
languageName: node
linkType: hard

"aggregate-error@npm:^3.0.0":
version: 3.1.0
resolution: "aggregate-error@npm:3.1.0"
Expand Down Expand Up @@ -7045,14 +7055,14 @@ __metadata:
languageName: node
linkType: hard

"axios@npm:^1.1.3":
version: 1.4.0
resolution: "axios@npm:1.4.0"
"axios@npm:^1.6.1":
version: 1.6.1
resolution: "axios@npm:1.6.1"
dependencies:
follow-redirects: "npm:^1.15.0"
form-data: "npm:^4.0.0"
proxy-from-env: "npm:^1.1.0"
checksum: b987e4259e5cfc93e95ee306c267a44380bbc045789a91b716e8434a75e22987344605eb4e133482fe285dd3a2e0b7e791ba26999965f04a5ecdde25f56930cb
checksum: fb091af3ad47d70fdcba5e71654b9e3c56947d93d8b2375dd0b4db63de9982adab6235aebc514488aa289c7faf103b09e8911280e6f6b1112d1604fe5f111f71
languageName: node
linkType: hard

Expand Down