Skip to content

Commit

Permalink
count processed entires accurately
Browse files Browse the repository at this point in the history
  • Loading branch information
dcrosta committed Sep 20, 2011
1 parent 07bd1fe commit 7dbb843
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions professor/logic.py
Expand Up @@ -87,18 +87,19 @@ def parse(database, entry):
# skip certain namespaces
if collection.startswith('system.') or \
collection.startswith('tmp.mr.'):
return
return False

optype = entry.get('op')
subparser = PARSERS.get(optype)
if subparser:
if not subparser(entry):
return
return False

entry = sanitize(entry)
entry['database'] = database['_id']

db.profiles.save(entry)
return True

def update(database):
now = datetime.utcnow()
Expand All @@ -111,8 +112,8 @@ def update(database):
conndb = connect_to(database)
i = 0
for entry in conndb.system.profile.find(query):
parse(database, entry)
i += 1
if parse(database, entry):
i += 1

database['timestamp'] = now
db.databases.save(database)
Expand Down

0 comments on commit 7dbb843

Please sign in to comment.