On Fri, Sep 18, 2009 at 4:03 PM, nitin gupta <span dir="ltr"><<a href="mailto:nitingupta.iitg@gmail.com">nitingupta.iitg@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
hey, thanks for pointing this out but as I see the job queue module uses a timer_read('page') to see the current execution time. Who starts this timer? Is it set by the PHP when the execution starts? becuase if it so, then the work is done.</blockquote>
<div><br>Core Drupal starts this timer for you in bootstrap.inc.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
<br><div>One more thing I would like to ask from the experienced ones, I have been working with PHP for just a while now (say 10 months), but what I am really confused about is how do we get to know so many things that are of our interest? I mean sometimes I just end up reinventing the wheel.</div>
<div><div class="im"><br clear="all">--<br>Regards,<br>Nitin Kumar Gupta<br><a href="http://publicmind.in/blog/" target="_blank">http://publicmind.in/blog/</a><br>
<br><br></div><div><div></div><div class="h5"><div class="gmail_quote">On Sat, Sep 19, 2009 at 1:15 AM, Michael Prasuhn <span dir="ltr"><<a href="mailto:mike@mikeyp.net" target="_blank">mike@mikeyp.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You may want to check out the Job Queue module, as it provides the functionality you are looking for. You could either add a dependency on it (recommended) or at least read through the code to see how it works, to prevent timeouts (It has a feature to check execution time and stop processing if the time reached is half of the max execution time).<br>
<br>
<a href="http://drupal.org/project/job_queue" target="_blank">http://drupal.org/project/job_queue</a><br>
<br>
-Mike<br>
__________________<br><font color="#888888">
Michael Prasuhn<br>
503.512.0822 office<br>
<a href="mailto:mike@mikeyp.net" target="_blank">mike@mikeyp.net</a><br>
<a href="http://mikeyp.net" target="_blank">http://mikeyp.net</a></font><div><div></div><div><br>
<br>
On Sep 18, 2009, at 10:16 AM, nitin gupta wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
I am maintaining the module feedapi imagegrabber, which pulls the images from the original url of the feed items (just like google reader). It is implemented on the top of feedapi and hence implements the feedapi_after_refresh() hook, which is basically fired by the feedapi after it has refreshed the feed.<br>
<br>
Now, as my module download images from an external website, I can never be sure about the time it will take to complete the job of downloading images for all the feed items. Therefore, sometimes I get a 'fatal execution time exceeded error'. How can I know how much execution time is left, so that I can return on time by saving the rest of the work as a cron job?<br>
<br>
I have gone through the source code of FeedAPI which implements hook_cron(). It uses a variable called 'cron_semaphore', which I am guessing is some way to share execution time but am unable to get how. I will really appreciate if someone can explain the above to me or provide some tutorial links on writing a good hook_cron implementation.<br>
<br>
--<br>
Regards,<br>
Nitin Kumar Gupta<br>
<a href="http://publicmind.in/blog/" target="_blank">http://publicmind.in/blog/</a><br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Khalid M. Baheyeldin<br><a href="http://2bits.com">2bits.com</a>, Inc.<br><a href="http://2bits.com">http://2bits.com</a><br>Drupal optimization, development, customization and consulting.<br>
Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. -- Leonardo da Vinci<br>