Add 'close' method to api_nb
Now there are cases in which the assumption that api_nb does not close are not valid any more, as external apps may use the api_nb as well. Currently the external apps that use the api_nb do not enable the pubsub, but once this behavior is changed, we will need to support releasing resources, namely the subscriber thread. If we fail to do so, the thread will remain and our app will not exit. Also, a good code writing dictates that for any resource you acquire one must have a way of releasing it... Change-Id: Icd9e268a0f71bb8dc571d0e33c54f489685dd9f3
This commit is contained in:
parent
a95344638c
commit
85771be035
|
@ -122,6 +122,12 @@ class NbApi(object):
|
|||
self.db_change_callback)
|
||||
self.subscriber.register_hamsg_for_db()
|
||||
|
||||
def close(self):
|
||||
if self.publisher:
|
||||
self.publisher.close()
|
||||
if self.subscriber:
|
||||
self.subscriber.close()
|
||||
|
||||
def db_recover_callback(self):
|
||||
# only db with HA func can go in here
|
||||
self.driver.process_ha()
|
||||
|
|
Loading…
Reference in New Issue