diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/pixelated/adapter/tag_index.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/service/pixelated/adapter/tag_index.py b/service/pixelated/adapter/tag_index.py index 6cc2a68d..25108643 100644 --- a/service/pixelated/adapter/tag_index.py +++ b/service/pixelated/adapter/tag_index.py @@ -24,12 +24,15 @@ class TagIndex: Manages an index for mail's tags using a file storage. """ - def __init__(self, filename): - self.db = dbm.open(filename, 'c') + def __init__(self, db_path): + self.db_path = db_path + self.db = dbm.open(db_path, 'c') atexit.register(self.close_db) def set(self, tag): self.db[tag.name] = tag.as_json_string() + self.close_db() # force flush + self.db = dbm.open(self.db_path, 'c') def get(self, tag_name): if tag_name in self.db: |