powered by Jive Software

Monitor plugin | xep0313 | query does not fetch most recent messages


#1

I have the following situation:

Alice has started a room by herself and sends some messages.

Bob joins that room.

I want to send Bob the messages Alice wrote. I try to use the monitoring plugin to achieve this. I query for the last like 10 minutes of history and receive most of the messages. I send those to Bob. The problem is that the last minute or so of messages is missing.

I assume the problem lies within the plugin:

The archiveTask in ConversationManager is set to run every minute, so it persists the incoming messages every minute.

When I query the plugin for the messages of the last ten minutes I directly uses the persistence manager to get those messages, but I obviously miss those that are not persisted.

Is there any way I can work around that or fix it?

A horrible hack I thought of was implementing the manual save of xep0136 and manually save the messages before Bob tries to get the messages.


#2

Hi David,

I think you’ve uncovered a bug. I’ve created https://issues.igniterealtime.org/browse/OF-1200 to track this issue.


#3

Hi David,

The Archiving part of the Monitoring plugin stores chat logs. These logs can be retrieved again by the clients.

To improve performance, logs are temporarily cached, and written to a database periodically.

So that when you featch message from database using query it will not populated because it is yet to store and it lives in cache memory.

But if you try after some time period it will populated becuase of after certain time perioad database has been updated and recent message will be stores in data table and you will get those messages. I was facing the same issue and after that i had created a method which stores data immediatily insted of storing cache memory so i can get all message without any delay. you can do the same for fixing this issue.

Hope it will help you.


#4

Hi Guus,

I have seen in this issue as you mentioned message history is written periodically to database in ofMessageArchive table and delay time period is 1 minute so every one minute taskengine will wake up and store all the message in table which is in message queue and clear queue and once again it will start to push new message in message queue and so on continues.

But if you want to retrive all message which is yet to write in db you need to look at message queue to retrive all the message which is still in cache memory or you can reduce delay time but it is not good idea.

I have tried to comment on jira bug tracker but i do not have privilages for that so i am posting here. Please let me know if i am not wrong in this case so that i can try to retrive all message from message queue to fixing this issue.


#5

A follow-up fix is being worked on here: https://github.com/igniterealtime/openfire-monitoring-plugin/issues/38


#6

great thanks for taking this.

Let me know if i can help to contribute anything in terms of development ready to take a pull request but not if i can do that or not.


#7

Hi! I’d love your feedback on the PRs in Openfire and in the Monitoring plugin! The latest state of the code is somewhat usable, but still suffers from bugs. It’s pretty hard to test all variants of code flow (with different clients, even), so any help there is much appreciated as well!