Long Running Background Scripts with CodeIgniter

I’ve been working on a project using CodeIgniter recently, and have been trying to clean some stuff up so that long running background scripts use the same code as the live system. Sane, every framework has some way of wiring it up so you can run command line tasks using the same framework as you’re running for web requests, and CodeIgniter is no exception. For some reason stuff that used to run find as bare mysql scripts kept running out of memory when I ran it within CI. Turns out the DB wrapper actually stores all the queries it runs in a big array. Not an issue when processing web requests I’m sure, but definitely an issue when you’re running big background tasks. If you want to keep your scripts from running out of memory it’s easy enough to do:

$this->db->save_queries = false;

This entry was posted in Open Source, Software. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">