CodeIgniter Forums
Autoload DB and don't connect until a query is made - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: Autoload DB and don't connect until a query is made (/showthread.php?tid=71191)



Autoload DB and don't connect until a query is made - spjonez - 07-17-2018

It's handy to be able to autoload the database library but in some cases (webhooks for example) this can cause issues when you're flooded with requests. Since it auto connects even if you have code in place to throttle logic you're still creating and dropping connections to the DB.

The way the DB code is structured it's a bit of a pain to overload the methods necessary to accomplish this. If I make a patch and submit a PR is this something you'd accept as a change? How I go about coding it for myself depends on your likelihood of accepting it as a change for everyone.