I am using Poormanscron which allows for interval cron runs. Bascially, the way it works is a cron job runs on the first page load after the interval, which is cool.

However, the way my site works, I'd like a person to be able to search through the site's content right after a post is made. As you know, the search isn't re-indexed till the next cron.

So, I'd like the crons to refresh every 10 minutes.

Is that too much on the server?

Or better yet, is there a module that will run a cron job after any post is uploaded?

Thanks
BigSend
http://bigsendworld.com

Comments

Kuldip Gohil’s picture

I have one idea you can invoke your cron on hook_nodeapi() hook when your new post is published....

function hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
       case 'insert':
       module_invoke_all('cron');
  }
}

i hope by using this your every latest post comes in search result you have no need to set cron anywhere if you have only need for this(search) purpose.

--
Kuldip Gohil
Software Engineer - Global Software Consulting (Gloscon)
1-888-DRUPAL-9 (378-7259)
http://www.gloscon.com

sikhone’s picture

Thanks Kuldip.......
your ideas is great........ It worked for me also.......

Thanks

bigsend’s picture

Hey That is a great idea...

I haven't yet done any module development or adding any code to drupal though..

Which file to do I add that piece of code to? Or, if I have to create a separate file and put that code in there, where should I put that file and what should I call it?

-Thanks
BigSend
http://bigsendworld.com

ajay gadhavana’s picture

You can easily write this code in your custom module. 

hook_nodeapi where hook will be your module name, If my module name is first_module then this function will be first_module_nodeapi()

if you don't know how to create custom module then please check this https://www.drupal.org/docs/7/creating-custom-modules

bigsend’s picture

Bump...

-Thanks
BigSend
http://bigsendworld.com