uhm^3. The code is quite unfixable as it is (launching scheduler with web2py.py -K appname). Remember that the only thing I'm trying to fix is the main process using idle connections to all databases defined in the models of you app.
However, there's a small unknown trick: the scheduler can be started on its own, and process happily tasks defined in applications, as long as
they are reachable from within the path you're launching it.
The former translates to: if you are on the same path web2py is in, you can use another commandline to launch the scheduler, whose main process will only be aware of the "db_sched" connection.
Small fixes are needed to make the "unknown trick" work again (up until now the "trick" hasn't been tested much) but the working file is
here .
You should start as
cd web2py # <<-- path where web2py.py is
python gluon/scheduler.py -u uri_of_the_db -f folder -L 0 -b 2
where:
-
uri_of_the_db is the database uri (i.e.
postgresql://....., mind that for sqlite, you should pass the entire relative path, as in
sqlite:///applications/appname/databases/storage.sqlite)
-
folder is the relative folder where the database tables are (i.e.
applications/appname/databases/ )
- the number after -L is the logging level (0 all, 100 nothing)
- the number after -b is the heartbeat in seconds
Please try it and see if the idle connections are still there or not.