I am building a site with python/django, running bitcoind in the background. I need to constantly check all addresses in the wallet to do a sql insert statement to my database whenever an incoming transaction is received, and maybe send some funds out in certain cases.
My site is working ok, and I wrote a python script that runs separate and uses a simple while true loop to achieve this. The problem is, when the script is running, it takes up too much memory and the site times out when I reload it. How to avoid this? I really need a background process running at all times. I am trying to use threading in the script, but it still seems to hog too much memory.
I thought about running bitcoind with the same wallet and the script on a separate computer, but I heard that is a bad idea.