diff --git a/packages/query/CHANGELOG.md b/packages/query/CHANGELOG.md index b167eda124..558eb1ad94 100644 --- a/packages/query/CHANGELOG.md +++ b/packages/query/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- High CPU usage caused by interval with 0ms (#2614) ## [2.17.1] - 2024-11-28 ### Fixed diff --git a/packages/query/src/graphql/graphql.module.ts b/packages/query/src/graphql/graphql.module.ts index 53023f8629..6b47e021de 100644 --- a/packages/query/src/graphql/graphql.module.ts +++ b/packages/query/src/graphql/graphql.module.ts @@ -118,6 +118,8 @@ export class GraphqlModule implements OnModuleInit, OnModuleDestroy { } private setupKeepAlive(pgClient: PoolClient) { + const interval = argv['sl-keep-alive-interval'] || 180000; + logger.info(`Setup PG Pool keep alive. interval ${interval} ms`); setInterval(() => { void (async () => { try { @@ -126,7 +128,7 @@ export class GraphqlModule implements OnModuleInit, OnModuleDestroy { getLogger('db').error('Schema listener client keep-alive query failed: ', err); } })(); - }, this.config.get('sl-keep-alive-interval')); + }, interval); } private async createServer() {