|
@@ -9,8 +9,7 @@ export class BufferService {
|
|
|
private connectionState: BehaviorSubject<ConnectionState>;
|
|
|
private messageBuffer: Message[] = [];
|
|
|
private messageModel!: Model<Message>
|
|
|
- private readonly dbUrl: string = process.env.MONGO as string;
|
|
|
-
|
|
|
+ private readonly dbUrl!: string
|
|
|
constructor(
|
|
|
messageFromApp: Subject<Message>,
|
|
|
connectionStateSubject: BehaviorSubject<ConnectionState>,
|
|
@@ -80,7 +79,7 @@ export class BufferService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private handleIncomingMessage(message: Message): void {
|
|
|
+ private handleIncomingMessage(message: any): void {
|
|
|
if (this.connectionState.getValue().status === "BUFFER") {
|
|
|
this.bufferMessage(message);
|
|
|
}
|
|
@@ -105,7 +104,7 @@ export class BufferService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private async bufferMessage(message: Message): Promise<void> {
|
|
|
+ private async bufferMessage(message: any): Promise<void> {
|
|
|
if (this.messageModel) {
|
|
|
try {
|
|
|
// const newMessage = new this.messageModel(message);
|
|
@@ -126,8 +125,9 @@ export class BufferService {
|
|
|
// Implement retry logic or additional error handling here
|
|
|
}
|
|
|
} else {
|
|
|
- this.messageBuffer.push(message); // Fallback to local buffer if model is not defined
|
|
|
- console.log(`pushing ${(message.message as MessageLog).appData.msgId} into local array buffer under ${this.bufferIdentifier}.... There is now ${this.messageBuffer.length} messages`);
|
|
|
+ this.messageBuffer.push(message);
|
|
|
+ console.log(this.messageBuffer) // Fallback to local buffer if model is not defined
|
|
|
+ console.log(`pushing into local array buffer under ${this.bufferIdentifier}.... There is now ${this.messageBuffer.length} messages`);
|
|
|
}
|
|
|
}
|
|
|
|