<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1039877" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1039877</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/creating-cron-refresh-feeds#comment-1225461</link>
    <description> &lt;p&gt;Awesome, thanks for all the help. I&#039;ve played with it some more and it was the timing of the cache duration and the cron that weren&#039;t syncing up. Right now I have it set so the cache expires just before (30 seconds) the cronjob runs, since it seems it was the cron that was the slow one. I&#039;m wondering if shortening the time span even more would be better, say a second or two before the cron runs have the cache expire. Either way, I think this will work for now so thanks again for your time.&lt;/p&gt;
 </description>
     <pubDate>Thu, 18 Oct 2007 21:06:45 +0000</pubDate>
 <dc:creator>eightgames</dc:creator>
 <guid isPermaLink="false">comment 1225461 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/creating-cron-refresh-feeds#comment-1225307</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;eightgames wrote:&lt;/strong&gt; Another page, which I&#039;m assuming would be an exact copy of the index so that it has the same feeds, which is not viewable to the public, would have it&#039;s content refreshed via the cron and the resulting cache files would be stored in the same cache folder that the main index.php would use?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Yes, the difference between this and the main--public viewable--file is that the file cron loads sets the cache duration to something &lt;strong&gt;very&lt;/strong&gt; short. &lt;em&gt;Hopefully&lt;/em&gt; this will cause the cache to be refreshed, unfortunately I don&#039;t know whether this would work since I&#039;ve never used that software. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;eightgames wrote:&lt;/strong&gt; I guess I&#039;m not sure what the difference would be between this and having the cron access the main index.php.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;It will cut out the race condition. If you&#039;ve got the cache set to expire every 15 minutes and the cron job set to run every 15 minutes, how can you be certain the cron job is going to get open the file before a user does? This seems to be what&#039;s causing your problem. You could set the cron job to run at particular times, but unless you can also set the cache to expire at particular times you&#039;ll have the same problem. For example: if the cron is set to run at 15 minutes past every hour and the cache is set to expire every 15 minutes, how do you know the cache isn&#039;t going to expire at one minute to the hour, then at 14 minutes past the hour? That&#039;s a whole minute where if a user visits that page they&#039;ll have to wait for the cache to be refreshed.&lt;/p&gt;
&lt;p&gt;Although this probably wont be much of an issue unless you get lots of visitors, it&#039;s still rather sloppy and likely to cause problems. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;eightgames wrote:&lt;/strong&gt; All this talk about caching duration also has me wondering, what is that? It&#039;s not like the cache files are automatically deleted after a set amount of time so what does the duration mean?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Well, you get what a cache is right? In the case of this software it&#039;s a copy of the RSS feeds, so it doesn&#039;t have to go and get the feeds every time the page is loaded. Every time the software loads it looks at how long ago the cache was created, if that is longer than the &#039;cache duration&#039; then the software retrieves all the feeds again, overwriting the cache. So you&#039;re correct, it&#039;s not deleted as soon as it goes out of date, but overwritten when the script is next run. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 14 Oct 2007 04:34:57 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1225307 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/creating-cron-refresh-feeds#comment-1225303</link>
    <description> &lt;p&gt;Hi, and thanks for the detailed response. I&#039;ve been testing more today and you are indeed correct, it is the timing of the caching that is the problem. I&#039;m using the curl script I posted above but I&#039;ll try the new cron you&#039;ve provided as well. What I ended up doing was setting the cron to a short period of time, say 5 minutes, and matched the caching duration in SimplePie. I then watched the cache folder by refreshing my ftp (after deleting all previously stored cache files) to see if new cache files would appear at the 5 minute mark. I was happy to see that the cron did access the page and triggered the caching, however, I noticed that it would take at least a couple minutes for all cache files to be stored. I think that processing delay is what was not allowing the cron and cache to sync up.&lt;/p&gt;
&lt;p&gt;Yes, I did post on the SimplePie forums, and many other places, since this seem to be a common problem that really hasn&#039;t been documented with good step-by-step instructions yet. Most people simply say &quot;set up a cron and you&#039;re fine&quot; but obviously it&#039;s more involved than that.&lt;/p&gt;
&lt;p&gt;Your explanation makes perfect sense (thank you!) however, I&#039;m not sure I follow your last paragraph only because I&#039;m very new to crons or back-end programming. Please let me know if I&#039;m understanding this correctly. So the main page would be my index.php that viewers see and the caching duration for this page would be &lt;strong&gt;very&lt;/strong&gt; long so that it never refreshes. Another page, which I&#039;m assuming would be an exact copy of the index so that it has the same feeds, which is not viewable to the public, would have it&#039;s content refreshed via the cron and the resulting cache files would be stored in the same cache folder that the main index.php would use? I guess I&#039;m not sure what the difference would be between this and having the cron access the main index.php.&lt;/p&gt;
&lt;p&gt;All this talk about caching duration also has me wondering, what is that? It&#039;s not like the cache files are automatically deleted after a set amount of time so what does the duration mean?&lt;/p&gt;
&lt;p&gt;Again, thank you very much for the response.&lt;/p&gt;
 </description>
     <pubDate>Sat, 13 Oct 2007 19:38:09 +0000</pubDate>
 <dc:creator>eightgames</dc:creator>
 <guid isPermaLink="false">comment 1225303 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/creating-cron-refresh-feeds#comment-1225302</link>
    <description> &lt;p&gt;When you&#039;ve got it working you might want to change your curl line to:&lt;br /&gt;
&lt;code&gt;curl &lt;a href=&quot;http://www.example.com&quot; title=&quot;http://www.example.com&quot;&gt;http://www.example.com&lt;/a&gt; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/code&gt;&#039;&lt;br /&gt;
That&#039;ll stop you getting the entire contents of the page as an e-mail (although that might be desirable for now).&lt;/p&gt;
&lt;p&gt;This seems correct, I don&#039;t think there&#039;s anything wrong with your cron jobs. The problem is with timing, how do you ensure that it&#039;s always the cron job that triggers the RSS reload? Even though you&#039;ve got them both designed to go off every 15 minutes that doesn&#039;t mean that the cache will expire and cron job activate at the right times.&lt;/p&gt;
&lt;p&gt;You need to make that script &lt;em&gt;only&lt;/em&gt; refresh the RSS feeds when the cron job is run. Otherwise you&#039;ll always have what&#039;s called a &#039;&lt;a href=&quot;http://www.google.com/search?client=opera&amp;amp;rls=en&amp;amp;q=define:race+condition&amp;amp;sourceid=opera&amp;amp;ie=utf-8&amp;amp;oe=utf-8&quot; class=&quot;bb-url&quot;&gt;race condition&lt;/a&gt;&#039;, the two events will only rarely sync with each other.&lt;/p&gt;
&lt;p&gt;I went and had a look on the software your using&#039;s Web site, are you chevy409 in &lt;a href=&quot;http://simplepie.org/support/viewtopic.php?id=1165&quot; class=&quot;bb-url&quot;&gt;this thread&lt;/a&gt;? Was reading some other threads in there and it looks like there&#039;s no way of running the script so it&#039;s only refreshed on a cron run, I find it a little weird that the writer of the software has never setup a cron job.&lt;/p&gt;
&lt;p&gt;Maybe on the main page you could set the &lt;a href=&quot;http://simplepie.org/wiki/reference/simplepie/set_cache_duration&quot; class=&quot;bb-url&quot;&gt;cache duration to infinity&lt;/a&gt; (or as near to infinity as the software will let you, 99999 for example), then create a new page just for cron where the cache duration is set to 1. So on the page that people view the cache is never refreshed, but the page the cron job views always refreshes the cache. This does depend upon how the script caches feeds though.&lt;/p&gt;
&lt;p&gt;Does that make sense? Feel free to ask on that forum and refer to this page, if I&#039;m correct I&#039;ll even write that cron tutorial the author is so desperate for. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 13 Oct 2007 19:13:56 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1225302 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
