Skip to content

Commit

Permalink
fix: pool and cache cleanup expiration time for internal pooling (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
joyc-bq authored Nov 15, 2024
1 parent 66f7c0f commit fb1632d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions common/lib/internal_pooled_connection_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import { PoolClientWrapper } from "./pool_client_wrapper";
import { logger } from "../logutils";

export class InternalPooledConnectionProvider implements PooledConnectionProvider, CanReleaseResources {
static readonly CACHE_CLEANUP_NANOS: bigint = BigInt(60_000_000_000); // 60 minutes
static readonly POOL_EXPIRATION_NANOS: bigint = BigInt(30_000_000_000); // 30 minutes
static readonly CACHE_CLEANUP_NANOS: bigint = BigInt(10 * 60_000_000_000); // 10 minutes
static readonly POOL_EXPIRATION_NANOS: bigint = BigInt(30 * 60_000_000_000); // 30 minutes
protected static databasePools: SlidingExpirationCache<string, any> = new SlidingExpirationCache(
InternalPooledConnectionProvider.CACHE_CLEANUP_NANOS,
(pool: any) => pool.getActiveCount() === 0,
Expand All @@ -62,8 +62,6 @@ export class InternalPooledConnectionProvider implements PooledConnectionProvide

private static poolExpirationCheckNanos: bigint = InternalPooledConnectionProvider.POOL_EXPIRATION_NANOS; // 30 minutes

constructor(poolConfig?: AwsPoolConfig);
constructor(poolConfig?: AwsPoolConfig, mapping?: InternalPoolMapping);
constructor(poolConfig?: AwsPoolConfig, mapping?: InternalPoolMapping, poolExpirationNanos?: bigint, poolCleanupNanos?: bigint) {
this._poolMapping = mapping;
InternalPooledConnectionProvider.poolExpirationCheckNanos = poolExpirationNanos ?? InternalPooledConnectionProvider.POOL_EXPIRATION_NANOS;
Expand Down

0 comments on commit fb1632d

Please sign in to comment.