Skip to content

Commit

Permalink
fixing #17 - at_eof fails
Browse files Browse the repository at this point in the history
fixing #17 - at_eof fails is there is no temp file.
  • Loading branch information
thanos authored Nov 1, 2016
1 parent e829b0f commit 0f02f69
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/tailchaser/tailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,15 @@ def filter(self, record):
return True

def at_eof(self, tmp_file, is_backfill_file_info):
if is_backfill_file_info:
is_backfill, (file_tailed, (fid, mtime, offset)) = is_backfill_file_info
if is_backfill and tmp_file != file_tailed:
os.unlink(tmp_file)
try:
if is_backfill_file_info:
is_backfill, (file_tailed, (fid, mtime, offset)) = is_backfill_file_info
if is_backfill and tmp_file != file_tailed:
if os.path.exists(tmp_file):
os.unlink(tmp_file)
except (IOError, OSError):
log.warning("at_eof failed to remove: %s", tmp_file)


def run(self, source_pattern, receiver=None):
self.startup()
Expand Down

0 comments on commit 0f02f69

Please sign in to comment.