- int processedMsgs = insertMessagesGracefully(msglist);
- int remainingMsgs = msglist.count() - processedMsgs;
- if(remainingMsgs > 0) {
- if(msglist.first().msgId() < msglist.last().msgId()) {
- // in Order - we have just successfully processed "processedMsg" messages from the end of the list
- _messageBuffer << msglist.mid(0, remainingMsgs);
- } else {
- _messageBuffer << msglist.mid(processedMsgs);
+ if(_messageBuffer.isEmpty()) {
+ int processedMsgs = insertMessagesGracefully(msglist);
+ int remainingMsgs = msglist.count() - processedMsgs;
+ if(remainingMsgs > 0) {
+ if(msglist.first().msgId() < msglist.last().msgId()) {
+ // in Order - we have just successfully processed "processedMsg" messages from the end of the list
+ _messageBuffer = msglist.mid(0, remainingMsgs);
+ } else {
+ _messageBuffer = msglist.mid(processedMsgs);
+ }
+ qSort(_messageBuffer);
+ QCoreApplication::postEvent(this, new ProcessBufferEvent());