Skip to content

Commit

Permalink
improved file format, increasing I/O performance by storing hashes in…
Browse files Browse the repository at this point in the history
…stead of html strings
  • Loading branch information
mtill committed Aug 10, 2017
1 parent e8326d9 commit 7f65250
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mwc.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,19 +295,19 @@ def pollWebsites():
else:
# otherwise, check which parts of the site were updated
changes = 0
fileContents = getStoredHashes(site['shortname'])
fileHashes = getStoredHashes(site['shortname'])
i = 0
for content in parseResult['contents']:

contenthash = hashlib.md5(content.encode(defaultEncoding)).hexdigest()
if contenthash not in fileContents:
if contenthash not in fileHashes:
if config.maxMailsPerSession == -1 or mailsSent < config.maxMailsPerSession:
changes += 1
sessionHashes.append(contenthash)

subject = '[' + site['shortname'] + '] ' + parseResult['titles'][i]
print(' ' + subject)
if config.enableMailNotifications and len(fileContents) > 0:
if config.enableMailNotifications and len(fileHashes) > 0:
sendmail(receiver, subject, content, (site.get('type', 'html') == 'html'), site['uri'])
mailsSent = mailsSent + 1

Expand Down

0 comments on commit 7f65250

Please sign in to comment.