@@ -376,17 +376,17 @@ if (
376376}
377377
378378// Initialize Valkey (optional - for vote buffer persistence)
379- const valkey = await initializeValkey ( { valkeyUrl : config . VALKEY_URL , log } ) ;
379+ const queueValkey = await initializeValkey ( { valkeyUrl : config . QUEUE_VALKEY_URL , log } ) ;
380380
381381// Initialize VoteBuffer (batches votes to reduce DB contention)
382382const voteBuffer = createVoteBuffer ( {
383383 db,
384- valkey,
384+ valkey : queueValkey ,
385385 flushIntervalMs : config . VOTE_BUFFER_FLUSH_INTERVAL_MS ,
386386 valkeyBatchLimit : config . VOTE_BUFFER_VALKEY_BATCH_LIMIT ,
387387} ) ;
388388log . info (
389- `[API] Vote buffer initialized (flush interval: ${ String ( config . VOTE_BUFFER_FLUSH_INTERVAL_MS ) } ms, batch limit: ${ String ( config . VOTE_BUFFER_VALKEY_BATCH_LIMIT ) } , persistence: ${ valkey !== undefined ? "Valkey" : "in-memory only" } )` ,
389+ `[API] Vote buffer initialized (flush interval: ${ String ( config . VOTE_BUFFER_FLUSH_INTERVAL_MS ) } ms, batch limit: ${ String ( config . VOTE_BUFFER_VALKEY_BATCH_LIMIT ) } , persistence: ${ queueValkey !== undefined ? "Valkey" : "in-memory only" } )` ,
390390) ;
391391
392392// Initialize Notification SSE Manager for real-time notifications
@@ -396,7 +396,7 @@ notificationSSEManager.initialize();
396396// Initialize ExportBuffer (batches export requests to reduce system load)
397397const exportBuffer = createExportBuffer ( {
398398 db,
399- valkey,
399+ valkey : queueValkey ,
400400 notificationSSEManager,
401401 flushIntervalMs : 1000 ,
402402 maxBatchSize : config . EXPORT_CONVOS_BUFFER_MAX_BATCH_SIZE ,
@@ -408,13 +408,13 @@ const exportBuffer = createExportBuffer({
408408 config . EXPORT_CONVOS_BUFFER_STALE_CLEANUP_EVERY_N_FLUSHES ,
409409} ) ;
410410log . info (
411- `[API] Export buffer initialized (flush interval: 1s, max batch: ${ String ( config . EXPORT_CONVOS_BUFFER_MAX_BATCH_SIZE ) } , cooldown: ${ String ( config . EXPORT_CONVOS_COOLDOWN_SECONDS ) } s, persistence: ${ valkey !== undefined ? "Valkey" : "in-memory only" } )` ,
411+ `[API] Export buffer initialized (flush interval: 1s, max batch: ${ String ( config . EXPORT_CONVOS_BUFFER_MAX_BATCH_SIZE ) } , cooldown: ${ String ( config . EXPORT_CONVOS_COOLDOWN_SECONDS ) } s, persistence: ${ queueValkey !== undefined ? "Valkey" : "in-memory only" } )` ,
412412) ;
413413
414414// Initialize ImportBuffer (batches import requests to reduce system load)
415415const importBuffer = createImportBuffer ( {
416416 db,
417- valkey,
417+ valkey : queueValkey ,
418418 notificationSSEManager,
419419 voteBuffer,
420420 axiosPolis,
@@ -426,7 +426,7 @@ const importBuffer = createImportBuffer({
426426 config . IMPORT_BUFFER_STALE_CLEANUP_EVERY_N_FLUSHES ,
427427} ) ;
428428log . info (
429- `[API] Import buffer initialized (flush interval: ${ String ( config . IMPORT_BUFFER_FLUSH_INTERVAL_MS ) } ms, max batch: ${ String ( config . IMPORT_BUFFER_MAX_BATCH_SIZE ) } , max concurrency: ${ String ( config . IMPORT_BUFFER_MAX_CONCURRENCY ) } , persistence: ${ valkey !== undefined ? "Valkey" : "in-memory only" } )` ,
429+ `[API] Import buffer initialized (flush interval: ${ String ( config . IMPORT_BUFFER_FLUSH_INTERVAL_MS ) } ms, max batch: ${ String ( config . IMPORT_BUFFER_MAX_BATCH_SIZE ) } , max concurrency: ${ String ( config . IMPORT_BUFFER_MAX_CONCURRENCY ) } , persistence: ${ queueValkey !== undefined ? "Valkey" : "in-memory only" } )` ,
430430) ;
431431
432432// Cleanup stuck imports/exports from previous server session
0 commit comments