Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
move mtime into new variable
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-v committed Oct 17, 2017
1 parent c8d7ca1 commit c5bffdc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions snoop/walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ def handle_folder(self, folder, parent):
)
self.documents.append((new_doc, created))

folder_mtime = os.path.getmtime(str(folder.resolve()))
if created or \
not new_doc.digested_at or \
new_doc.digested_at.timestamp() < os.path.getmtime(str(folder.resolve())):
queues.put('digest', {'id': new_doc.id})
new_doc.digested_at.timestamp() <= folder_mtime:
if new_doc.path: # avoid digesting / indexing the root
queues.put('digest', {'id': new_doc.id})

for child in folder.iterdir():
self.handle(child, new_doc)
Expand All @@ -87,9 +89,10 @@ def handle_file(self, file, parent):
},
)
self.documents.append((new_doc, created))
file_mtime = os.path.getmtime(str(file.resolve()))
if created or \
not new_doc.digested_at or \
new_doc.digested_at.timestamp() < os.path.getmtime(str(file.resolve())):
new_doc.digested_at.timestamp() <= file_mtime:
queues.put('digest', {'id': new_doc.id})

def files_in(doc):
Expand Down

0 comments on commit c5bffdc

Please sign in to comment.