You are here:  » [MOD] Skip same-sized feeds in feed update


[MOD] Skip same-sized feeds in feed update

Submitted by Kees on Thu, 2018-10-25 09:51 in

Hey guys,

Just wanted to share a small snippet to skip a feed fetch if the current feed is the same size (that way your cron won't import it again).

Add this on line 76 in /includes/automation.php

{code saved}

Greetz,
Kees

Submitted by support on Thu, 2018-10-25 11:07

Hello Kees,

Thanks for the notes; bear in mind that it is quite possible that if only a price has changed, for example 9.99 in the current feed becomes 9.97 in the new feed - the size will still be the same.

Also, cron.php uses the "zero down-time" import method where feeds are imported into a temporary table so that your site is never offline at all during import - so this means that all feeds need to be imported anyway even if they haven't changed.

However if you are running a custom cronjob command line for example;

cd /path/to/scripts/;/usr/bin/php fetch.php @ALL;/usr/bin/php import.php @MODIFIED

...then you could avoid importing unchanged feeds by using PHP's hash_file() function and compare the hash values rather than size - but bear in mind hashing potentially very large feeds is a processor intensive operation...

Cheers,
David.
--
PriceTapestry.com