Skip to content

Commit

Permalink
Use compressed index on save/load
Browse files Browse the repository at this point in the history
  • Loading branch information
pkittenis committed Nov 9, 2016
1 parent c97c7ea commit 091fc49
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions influxgraph/classes/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from logging.handlers import WatchedFileHandler
import itertools
import gc
import gzip

try:
import statsd
Expand Down Expand Up @@ -510,7 +511,7 @@ def save_index(self):
if not self.index_path:
return
try:
with open(self.index_path, 'wt') as index_fh:
with gzip.GzipFile(self.index_path, 'wt') as index_fh:
self.index.to_file(index_fh)
except IOError as ex:
logger.error("Error writing to index file %s - %s",
Expand All @@ -524,7 +525,7 @@ def load_index(self):
return
logger.info("Loading index from file %s", self.index_path,)
try:
index_fh = open(self.index_path, 'rt')
index_fh = gzip.GzipFile(self.index_path, 'rt')
except Exception as ex:
logger.error("Error reading index file %s - %s", self.index_path, ex)
return
Expand Down

0 comments on commit 091fc49

Please sign in to comment.