FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » nntp import reloads (duplicates) posts randomly (possible bug - fix provided - your call)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
nntp import reloads (duplicates) posts randomly [message #36066] Fri, 02 March 2007 05:12 Go to previous message
rdthoms is currently offline  rdthoms   United States
Messages: 12
Registered: January 2007
Karma:
Junior Member
Had a problem where the newsgroup link would seem to randomly reload (duplicate) a bunch of posts into the forum. Here is what I found and changed:

in the parse_msgs function in include/nntp.inc there is some logic where the function compares the last read message id ($start_id) with the first and last message ids available from your news server. It looks like this:

if ($start_id && $start_id > $this->group_first && $start_id <= $this->group_last) {
  $this->group_first = $start_id;
}


or what is really happening in psuedo code:

if (last_read > first_available && last_read <= last_available) {
  start reading from last_read
} else {
  start reading from first_available
}


The "random" problem would occur when the nntp server would somehow "lose" the last few posts. For example I would get a good sync reading messages 900-1000 from the nntp server and then start_id would be 1000. So far so good.

Then when the next sync happened sometimes for some reason the last message was 998 instead of the expected 1000 (maybe they deleted some spam or something).

Anyway, in that case the logic in the above snippet of code fails to start reading from last_read and instead starts reading from first_available! So now messages 900-998 get read again!

So I changed the code to:

if ($start_id && $start_id > $this->group_first) {
  $this->group_first = $start_id;
}


I don't see any reason to check that the local start_id is less than the group_last. If it happens that that is not the case then it seems to safely run and not read any messages.

I hope you can understand the issue and consider making the change permanent.

Thanks,
Richard

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Database or file to store message
Next Topic: Can not display online user name
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 04:03:32 GMT 2024

Total time taken to generate the page: 0.04093 seconds