Add develop debug branch

This commit is contained in:
Saulo Mendes Martins 2025-08-21 08:08:53 -03:00
parent 4385db2912
commit b30c004d7b

View File

@ -2,9 +2,6 @@ import { Logger } from '@config/logger.config';
import { BaileysEventMap, MessageUpsertType, proto } from 'baileys'; import { BaileysEventMap, MessageUpsertType, proto } from 'baileys';
import { catchError, concatMap, delay, EMPTY, from, retryWhen, Subject, Subscription, take, tap } from 'rxjs'; import { catchError, concatMap, delay, EMPTY, from, retryWhen, Subject, Subscription, take, tap } from 'rxjs';
// Log de teste que confirma que o arquivo foi carregado
require('fs').writeFileSync('/tmp/debug.log', `🧪 [TESTE] ARQUIVO CARREGADO - BaileysMessageProcessor - ${new Date().toISOString()}\n`, { flag: 'a' });
type MessageUpsertPayload = BaileysEventMap['messages.upsert']; type MessageUpsertPayload = BaileysEventMap['messages.upsert'];
type MountProps = { type MountProps = {
onMessageReceive: (payload: MessageUpsertPayload, settings: any) => Promise<void>; onMessageReceive: (payload: MessageUpsertPayload, settings: any) => Promise<void>;
@ -22,14 +19,10 @@ export class BaileysMessageProcessor {
}>(); }>();
mount({ onMessageReceive }: MountProps) { mount({ onMessageReceive }: MountProps) {
// Log que não é sobrescrito - escreve em arquivo
require('fs').writeFileSync('/tmp/debug.log', `🧪 [TESTE] mount chamado - ${new Date().toISOString()}\n`, { flag: 'a' });
this.processorLogs.log(`🧪 [TESTE] mount chamado - BaileysMessageProcessor inicializado`); this.processorLogs.log(`🧪 [TESTE] mount chamado - BaileysMessageProcessor inicializado`);
this.subscription = this.messageSubject this.subscription = this.messageSubject
.pipe( .pipe(
tap(({ messages }) => { tap(({ messages }) => {
// Log que não é sobrescrito - escreve em arquivo
require('fs').writeFileSync('/tmp/debug.log', `🚀 [BaileysMessageProcessor] Processing batch of ${messages.length} messages - ${new Date().toISOString()}\n`, { flag: 'a' });
this.processorLogs.log(`🚀 [BaileysMessageProcessor] Processing batch of ${messages.length} messages`); this.processorLogs.log(`🚀 [BaileysMessageProcessor] Processing batch of ${messages.length} messages`);
this.processorLogs.log(`🧪 [TESTE] LOG DE TESTE FUNCIONANDO - ${new Date().toISOString()}`); this.processorLogs.log(`🧪 [TESTE] LOG DE TESTE FUNCIONANDO - ${new Date().toISOString()}`);
messages.forEach((msg, index) => { messages.forEach((msg, index) => {
@ -61,8 +54,6 @@ export class BaileysMessageProcessor {
processMessage(payload: MessageUpsertPayload, settings: any) { processMessage(payload: MessageUpsertPayload, settings: any) {
const { messages, type, requestId } = payload; const { messages, type, requestId } = payload;
// Log que não é sobrescrito - escreve em arquivo
require('fs').writeFileSync('/tmp/debug.log', `🧪 [TESTE] processMessage chamado - messages: ${messages.length}, type: ${type} - ${new Date().toISOString()}\n`, { flag: 'a' });
this.processorLogs.log(`🧪 [TESTE] processMessage chamado - messages: ${messages.length}, type: ${type}`); this.processorLogs.log(`🧪 [TESTE] processMessage chamado - messages: ${messages.length}, type: ${type}`);
this.messageSubject.next({ messages, type, requestId, settings }); this.messageSubject.next({ messages, type, requestId, settings });
} }