libs ready i think
This commit is contained in:
parent
1b34da9a69
commit
9673ae70ef
9 changed files with 242 additions and 129 deletions
|
|
@ -6,7 +6,7 @@ import { cors } from 'hono/cors';
|
|||
import { getLogger, setLoggerConfig, shutdownLoggers } from '@stock-bot/logger';
|
||||
import type { QueueManager } from '@stock-bot/queue';
|
||||
import { Shutdown } from '@stock-bot/shutdown';
|
||||
import { ProxyManager } from '@stock-bot/di';
|
||||
import { ProxyManager } from '@stock-bot/utils';
|
||||
import type { ServiceContainer } from '@stock-bot/di';
|
||||
// Local imports
|
||||
import { setupServiceContainer } from './setup/database-setup';
|
||||
|
|
|
|||
|
|
@ -115,18 +115,13 @@ export async function setupServiceContainer(): Promise<ServiceContainer> {
|
|||
// Register Cache
|
||||
container.register({
|
||||
name: 'cache',
|
||||
factory: () => {
|
||||
const pool = connectionFactory.createCache({
|
||||
factory: async () => {
|
||||
const pool = await connectionFactory.createCache({
|
||||
name: 'default',
|
||||
config: {
|
||||
redisConfig: {
|
||||
host: dbConfig.dragonfly.host,
|
||||
port: dbConfig.dragonfly.port,
|
||||
db: dbConfig.dragonfly.db,
|
||||
},
|
||||
keyPrefix: 'data-ingestion:',
|
||||
ttl: 3600,
|
||||
enableMetrics: true,
|
||||
host: dbConfig.dragonfly.host,
|
||||
port: dbConfig.dragonfly.port,
|
||||
db: dbConfig.dragonfly.db,
|
||||
}
|
||||
});
|
||||
return pool.client;
|
||||
|
|
@ -137,32 +132,13 @@ export async function setupServiceContainer(): Promise<ServiceContainer> {
|
|||
// Register QueueManager
|
||||
container.register({
|
||||
name: 'queue',
|
||||
factory: () => {
|
||||
const pool = connectionFactory.createQueue({
|
||||
factory: async () => {
|
||||
const pool = await connectionFactory.createQueue({
|
||||
name: 'default',
|
||||
config: {
|
||||
redis: queueConfig?.redis || {
|
||||
host: dbConfig.dragonfly.host,
|
||||
port: dbConfig.dragonfly.port,
|
||||
db: dbConfig.dragonfly.db || 1,
|
||||
},
|
||||
defaultQueueOptions: {
|
||||
defaultJobOptions: queueConfig?.defaultJobOptions || {
|
||||
attempts: 3,
|
||||
backoff: {
|
||||
type: 'exponential',
|
||||
delay: 1000,
|
||||
},
|
||||
removeOnComplete: 10,
|
||||
removeOnFail: 5,
|
||||
},
|
||||
workers: 2,
|
||||
concurrency: 1,
|
||||
enableMetrics: true,
|
||||
enableDLQ: true,
|
||||
},
|
||||
enableScheduledJobs: true,
|
||||
delayWorkerStart: true,
|
||||
host: dbConfig.dragonfly.host,
|
||||
port: dbConfig.dragonfly.port,
|
||||
db: dbConfig.dragonfly.db || 1,
|
||||
}
|
||||
});
|
||||
return pool.client;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue