I put the "Personal Heartbeat Stream" on the user page. Initially, everything shows up fine. However, with "Poll every x seconds" enabled, duplicated messages are inserted into the stream. This already happened in an earlier version; I thought it was fixed already.

Comments

jaochoo’s picture

More detailed:
1) the stream initially only shows 2 entries (while, by configuration, it was supposed to show 15 entries max, and there are enough messages logged in the database as I can see in the DB)
2) even more confusing, it seems to show the first and last message (instead of the last two messages)
3) at the next poll (after x seconds) the first message in stream (i.e. the last message by time) gets duplicated, not more.
4) however, when the poll finds a new message in the database (i.e. in the meantime I performed some action) it will correctly include this message into the stream, but then, however, after another poll of x seconds duplicate this message again as in 3)

//edit: 1+2) also happen for the Public Stream.

jaochoo’s picture

Okay, now I understand why 1) and 2) are happening: It is grouping it together, depending on the setting of 7200 seconds. I set it to 0 seconds and there I can see all messages. Now could you explain a little bit more detailed about that? I was testing with wall posts (user posts something on another users wall using FBSS module) and I want that all wall posts show up (at least on the users wall; the public stream may use the grouping). For other messages (e.g. created a node) the grouping might make sense. Is there a way to define this for each message type?

Stalski’s picture

I am not sure i understand the last question.
I will give a more detailed explanation later on.

jaochoo’s picture

Okay, let me describe more detailled (I think, btw, I just saw the same request asked by another user): Now, the message gap (e.g. 7200) in which messages of the same type are handled to be grouped together is defined globally as a Heartbeat setting for the whole Heartbeat module, i.e. it effects every message type and every Heartbeat stream in the same way. But it would be nice to configure it in more detail, just imagine the following example:

- For a users microblog (status updates, shouts), the public Heartbeat of a website does not have to display all Shouts of a user, but only the most recent one, i.e. it is his most recent status. The personal Heartbeat of that user then however should display them all. (Also, you cannot really group/summarize Shouts together, it just does not make sense and just does not look like typical microblogging).
- For wall posts, the public Heartbeat can display grouped/summarized messages ("John, Paul and Mary wrote on Bills wall"), but then the personal Heartbeat of Bill should display single messages; again, grouping/summarizing them there just does not make sense, because on his personal wall he wants to see the full messages in a format like "John > Bill: Hi, how you doing?"
- For Nodes however, both stream can display a grouped/summarized message.

I think that come near to Facebook. However, it would be needed to define it per message-type and stream then, instead of defining the gap globally for the whole Heartbeat module. For example, once I define a message gap of 7200 (like the default settings), all microblogs/shouts/statusupdates of a user within that timeframe will be grouped together; even if I define it as a "single message" it will be grouped in a way that only the latest message is displayed (see points 1+2 earlier above). Same for wall posts of user A to user B: If within a timeframe of 7200 user A writes on user B's wall more than 1 time, only the latest wall post will be shown in all streams, because the older wall posts will be grouped together with the latest wall post. If I then turn off the message gap (i.e. set it to 0 instead of 7200), wall posts and microblods/shouts show up fine, but Nodes are not grouped anymore. And so on...

The errors 3+4) are gone btw. I cannot reproduce them. However, they were there in the beginning. Any experience with such error?

jaochoo’s picture

After I thought the error was gone, it now happened again. Unfortunately, I cannot reproduce it; it happens sometimes, and it does not happen another times. I now saw it in the "Personal Heartbeat" on the user profile pages: First, the stream is fine, but then the poll injects an item from the currently logged in user at it seems.

E.g.: User/1 is logged in, visiting the profile of User/3. First, the stream (correctly) shows only items related to User/3, but after x seconds another item is injected in the stream which is not related to User/3 (as it should be) but to the currently logged in User/1 who is visiting the profile of User/3.

Stalski’s picture

Assigned: Unassigned » Stalski
Status: Active » Fixed

I could reproduce it a few months ago, but not anymore. I consider this fixed and done. You can test this on the demo site as well. I know I did ;-)

Stalski’s picture

Status: Fixed » Closed (fixed)

I tested it very thorough! Feel free to reopen this when you can submit a use case exactly i can reproduce.

tugis’s picture

The comment #4 exactly explains the same problem I have with message gap value.

I found out that the problem related to "facebook status" is that in the "remove_message_duplicates" function, in case "Maximum gap" is set to more than 0, a "uniqueness" id is built:

$id = $message->message_id .'-'. $message->uid .'-'. $message->uid_target .'-'. $message->nid .'-'. $message->nid_target;

It happens that for status activities, no matter the content of the status, if they are within the same gap, their id will be considered the same and they will be marked as duplicates. I made a workaround (which I'm not very proud of it since I may find other activities with the same characteristics):

if($message->message_id == 'heartbeat_facebook_status') {
          $id = $message->message_id .'-'. $message->uid .'-'. $message->uid_target .'-'. $message->timestamp .'-'. $message->nid_target;
}else {
      $id = $message->message_id .'-'. $message->uid .'-'. $message->uid_target .'-'. $message->nid .'-'. $message->nid_target;
}

In my opinion the problem is that we should never check for duplicate messages, specially for messages of the type "single". Why should we?