Skip to content

Commit

Permalink
Merge pull request #41 from cisagov/bugfix/cursor-timeout
Browse files Browse the repository at this point in the history
Fix cursor timeout bug
  • Loading branch information
dav3r authored Mar 22, 2021
2 parents 012b9a1 + 1f81687 commit fbd0d7a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions report/generate_https_scan_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ def __init__(self, db, agency, debug=False):
csvreader = csv.reader(ocsp_file)
ocsp_exclusions = {row[0]: None for row in csvreader}

# Get list of all domains from the database
all_domains_cursor = self.__db.https_scan.find({
'latest': True,
'agency.name': agency
})
# Get list of all domains from the database. Use no_cursor_timeout
# to handle agencies with a large number of domains.
all_domains_cursor = self.__db.https_scan.find(
{"latest": True, "agency.name": agency}, no_cursor_timeout=True
)
# We really shouldn't include OCSP excluded domains in the
# total count. We do want to score them, for informational
# purposes, but the scores will not impact compliance.
Expand Down Expand Up @@ -224,6 +224,10 @@ def add_weak_crypto_data_to_domain(domain_doc,
self.__base_domains.append(domain_doc)
self.__agency_id = domain_doc['agency']['id']

# We instantiated this cursor without a timeout, so we have to
# close it manually.
all_domains_cursor.close()

# Get a count of the second-level domains an agency owns.
#
# Really I should exclude OCSP domains here, but this isn't
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.12
1.1.13

0 comments on commit fbd0d7a

Please sign in to comment.