Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduler Timeline extending 5:30 in future #5

Closed
vinayak-garg opened this issue Jun 19, 2012 · 1 comment
Closed

Scheduler Timeline extending 5:30 in future #5

vinayak-garg opened this issue Jun 19, 2012 · 1 comment

Comments

@vinayak-garg
Copy link

Hi,
A Big Thank You for sharing such a useful module for Magento. I needed to run a cron job (and inspect all the jobs as well), so I found a good place to add my code would be your heartbeatTask::run() method. I am not sure what is going on, but this is the screenshot of sheduler timeline. (Click on image to see it better).
Scheduler1

Here is my code (just in case, my code is causing it)

class Aoe_Scheduler_Model_HeartbeatTask {

    public function run() {

      date_default_timezone_set('Asia/Kolkata');
        $out = date('d.m.y h:i:s A')."\n";
        $old_time = time() - (30*24*60*60);//10min before timestamp
        $orders = Mage::getModel('sales/order')->getCollection()
          ->addFieldToFilter('status', 'pending')
          ->addFieldToFilter('cod_fee', array('null' => true))
          ->addFieldToFilter('created_at', array('lt' => $old_time))
          ->addAttributeToSelect('customer_email')
          ->addAttributeToSelect('created_at')
          ;

        file_put_contents('/home/vinayak/newcron6.txt', $out, FILE_APPEND);
      foreach ($orders as $order) {
        $out .= $order->getCustomerEmail()." @ ".$order->getCreatedAt()."\n";
//          $order->setState('pending_payment', true)->save();
        }
        file_put_contents('/home/vinayak/cron.txt', $out, FILE_APPEND);
        return true;
    }

}

BTW My code is not working correctly.
The executed at time for one of the job is "16:00:02" and finish at "21:30:02". This longish schedule turns up randomly.

Might it be because I am living in GMT+5:30 timezone?
Any insights would be helpful
Thanks!

@vinayak-garg
Copy link
Author

date_default_timezone_set('Asia/Kolkata'); was creating problem. I removed it, now it is working nicely.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant