Project: datamanagement
Issue DM-513: fix threading issues in CSS watcher
Fix problems with threads in watcher.py brought up in DM-225 by Serge: * A thread per database doesn't scale * There is a thread leak when a database is deleted * There is another design problem, in that each database thread looks like it is holding on to the same lsst.db.Db instance under the hood. I don't remember any consideration for thread safety from the lsst.db code when I reviewed it. Note for one that it is not safe to use a MySQL connection simultaneously from multiple threads (and I seem to recall that you are caching a connection inside Db instances). In practice, even the Python GIL may not save you, since calls into C code (i.e. the mysql client library) may very well release it.
Story points: 8