added cli-covarage tool and fixed more tests
This commit is contained in:
parent
b63e58784c
commit
b845a8eade
57 changed files with 11917 additions and 295 deletions
|
|
@ -80,3 +80,23 @@ export class PoolSizeCalculator {
|
|||
return Math.max(recommendedSize, latencyBasedSize, 2); // Minimum 2 connections
|
||||
}
|
||||
}
|
||||
|
||||
// Export convenience functions
|
||||
export function calculatePoolSize(
|
||||
serviceName: string,
|
||||
handlerName?: string,
|
||||
customConfig?: Partial<ConnectionPoolConfig>
|
||||
): PoolSizeRecommendation {
|
||||
return PoolSizeCalculator.calculate(serviceName, handlerName, customConfig);
|
||||
}
|
||||
|
||||
export function getServicePoolSize(serviceName: string): PoolSizeRecommendation {
|
||||
return PoolSizeCalculator.calculate(serviceName);
|
||||
}
|
||||
|
||||
export function getHandlerPoolSize(
|
||||
serviceName: string,
|
||||
handlerName: string
|
||||
): PoolSizeRecommendation {
|
||||
return PoolSizeCalculator.calculate(serviceName, handlerName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ export function registerCacheServices(
|
|||
container: AwilixContainer<ServiceDefinitions>,
|
||||
config: AppConfig
|
||||
): void {
|
||||
if (config.redis.enabled) {
|
||||
if (config.redis?.enabled) {
|
||||
container.register({
|
||||
cache: asFunction(({ logger }) => {
|
||||
const { createServiceCache } = require('@stock-bot/queue');
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export function registerDatabaseServices(
|
|||
config: AppConfig
|
||||
): void {
|
||||
// MongoDB
|
||||
if (config.mongodb.enabled) {
|
||||
if (config.mongodb?.enabled) {
|
||||
container.register({
|
||||
mongoClient: asFunction(({ logger }) => {
|
||||
// Parse MongoDB URI to extract components
|
||||
|
|
@ -36,7 +36,7 @@ export function registerDatabaseServices(
|
|||
}
|
||||
|
||||
// PostgreSQL
|
||||
if (config.postgres.enabled) {
|
||||
if (config.postgres?.enabled) {
|
||||
container.register({
|
||||
postgresClient: asFunction(({ logger }) => {
|
||||
const pgConfig = {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export function registerApplicationServices(
|
|||
}
|
||||
|
||||
// Proxy Manager
|
||||
if (config.proxy && config.redis.enabled) {
|
||||
if (config.proxy && config.redis?.enabled) {
|
||||
container.register({
|
||||
proxyManager: asFunction(({ logger }) => {
|
||||
// Create a separate cache instance for proxy with global prefix
|
||||
|
|
@ -58,7 +58,7 @@ export function registerApplicationServices(
|
|||
}
|
||||
|
||||
// Queue Manager
|
||||
if (config.queue?.enabled && config.redis.enabled) {
|
||||
if (config.queue?.enabled && config.redis?.enabled) {
|
||||
container.register({
|
||||
queueManager: asFunction(({ logger, handlerRegistry }) => {
|
||||
const { QueueManager } = require('@stock-bot/queue');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue