Fixed xf_feed_log updates on duplicate key?

Jake Bunce

Well-known member
What is the purpose of this code?

XenForo_Model_Feed::_insertFeedEntry

Rich (BB code):
		if ($writer->get('thread_id'))
		{
			$db->query('
				INSERT INTO xf_feed_log
					(feed_id, unique_id, hash, thread_id)
				VALUES
					(?, ?, ?, ?)
				ON DUPLICATE KEY UPDATE
					hash = VALUES(hash),
					thread_id = VALUES(thread_id)
			', array($feed['feed_id'], utf8_substr($entryData['id'], 0, 250), $entryData['hash'], $writer->get('thread_id')));
		}

Why would you update on duplicate when the purpose of xf_feed_log is to prevent duplicate rss posts? At this point in the execution the dupe checker has already run so there shouldn't be any duplicate insertions. I think the entire transaction should be rolled back at this point.

_____

I ask because of this guy's problem:

http://xenforo.com/community/threads/registered-feeds-posting-duplicates.19678/

It turns out the feed did not have a unique guid for all items. Granted, this is a problem with the feed itself. But the guid problem was causing the dupe checker to miss some items which were then allowed to be inserted by the above code. I found myself wondering why you would ever want to allow a duplicate insertion here.
 
Hoping we get some love from Kier on this. Just ran into this problem on one of my sites and am worried about my other sites having the same issue.
 
I'm not sure about the bug but some time im also facing same problem, I'm running multiple feeds and some time one feed starts causing problem and importing same article again and again any time when it runs. So i disabled that and then after few days another feed starts causing same problem.
 
I'm not sure about the bug but some time im also facing same problem, I'm running multiple feeds and some time one feed starts causing problem and importing same article again and again any time when it runs. So i disabled that and then after few days another feed starts causing same problem.

It's probably best that you start your own thread for your specific problem. Post in the Troubleshooting forum and include the URL of the feed. I will take a look.
 
Mike and I have both looked at this and tried to work out why the dupe update is there, and we kinda drew a blank. I'll change it in the next release to make it a bit more sensible.
 
Top Bottom