Prevent APICache from holding file descriptors open until program exit
Review Request #6899 — Created Feb. 4, 2015 and submitted
Previously the
APICachewould keep file descriptors open until the
program exited. This was because of a call toatexit.registerthat
increased the reference count of theAPICache. However, we always
write to the database after every database change, so this is
unnecessary. Removing the call toatexit.registerallows the open
file descriptors to be closed when anAPICachegoes out of scope.
Ran unit tests.
I ran the
test.pyfile attached in report of issue 3751 before and
after the change. Before the change, the list of open file
descriptors would grow with each call to thedoitfunction. After
the change, the list of open file descriptors is always be the
empty list.
Tool: PEP8 Style Checker Processed Files: rbtools/api/cache.py Tool: Pyflakes Processed Files: rbtools/api/cache.py