fixed up workers

This commit is contained in:
Boki 2025-06-24 13:27:43 -04:00
parent 60d7de1da8
commit f41622e530
5 changed files with 30 additions and 8 deletions

View file

@ -76,13 +76,13 @@ export class MonitoringService {
const stats: QueueStats[] = [];
try {
if (!this.container.queue) {
if (!this.container.queueManager) {
this.logger.warn('No queue manager available');
return stats;
}
// Get all queue names from the SmartQueueManager
const queueManager = this.container.queue as any;
// Get all queue names from the QueueManager
const queueManager = this.container.queueManager as any;
this.logger.debug('Queue manager type:', {
type: queueManager.constructor.name,
hasGetAllQueues: typeof queueManager.getAllQueues === 'function',
@ -92,7 +92,6 @@ export class MonitoringService {
// Always use the known queue names since web-api doesn't create worker queues
const handlerMapping = {
proxy: 'data-ingestion',
qm: 'data-ingestion',
ib: 'data-ingestion',
ceo: 'data-ingestion',
@ -127,6 +126,8 @@ export class MonitoringService {
stats.push({
name: handlerName,
service: serviceName,
queue: handlerName,
connected: true,
jobs: queueStats,
workers: {
@ -141,6 +142,8 @@ export class MonitoringService {
this.logger.warn(`Failed to get stats for queue ${handlerName}`, { error });
stats.push({
name: handlerName,
service: serviceName,
queue: handlerName,
connected: false,
jobs: {
waiting: 0,

View file

@ -23,6 +23,8 @@ export interface CacheStats {
export interface QueueStats {
name: string;
service: string;
queue: string;
connected: boolean;
jobs: {
waiting: number;

View file

@ -30,6 +30,7 @@ export function QueueStatsTable({ queues }: QueueStatsTableProps) {
<table className="w-full text-xs">
<thead>
<tr className="border-b border-border">
<th className="text-left py-2 px-3 text-text-secondary font-medium">Service</th>
<th className="text-left py-2 px-3 text-text-secondary font-medium">Queue</th>
<th className="text-center py-2 px-3 text-text-secondary font-medium">Status</th>
<th className="text-right py-2 px-3 text-text-secondary font-medium">Waiting</th>
@ -46,7 +47,8 @@ export function QueueStatsTable({ queues }: QueueStatsTableProps) {
<tbody>
{queues.map((queue) => (
<tr key={queue.name} className="border-b border-border hover:bg-surface-tertiary/50 transition-colors">
<td className="py-2 px-3 font-medium text-text-primary">{queue.name}</td>
<td className="py-2 px-3 font-medium text-text-primary">{queue.service}</td>
<td className="py-2 px-3 font-medium text-text-primary">{queue.queue}</td>
<td className="py-2 px-3 text-center">
<span className={cn(
'inline-block w-2 h-2 rounded-full',

View file

@ -23,6 +23,8 @@ export interface CacheStats {
export interface QueueStats {
name: string;
service: string;
queue: string;
connected: boolean;
jobs: {
waiting: number;

View file

@ -305,9 +305,22 @@ export class RedisCache implements CacheProvider {
return null;
}
this.updateStats(true);
const parsed = JSON.parse(value);
this.logger.debug('Cache raw get hit', { key });
return parsed;
try {
const parsed = JSON.parse(value);
this.logger.debug('Cache raw get hit', { key });
return parsed;
} catch (error) {
// If JSON parsing fails, log the error with more context
this.logger.warn('Cache getRaw JSON parse failed', {
key,
valueLength: value.length,
valuePreview: value.substring(0, 100),
error: error instanceof Error ? error.message : String(error)
});
// Return the raw value as-is if it can't be parsed
return value as unknown as T;
}
},
null,
'getRaw'