Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Fixing crash with uneven host database sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Christiane Ruetten authored and cr committed Aug 29, 2018
1 parent 687a8f1 commit 6b33e90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tlscanary/modes/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def run(self):
limit = len(self.sources) if self.args.limit is None else self.args.limit

# Split work into 50 chunks to conserve memory, but make no chunk smaller than 1000 hosts
next_chunk = self.sources.iter_chunks(chunk_size=limit/50, min_chunk_size=1000)
next_chunk = self.sources.iter_chunks(chunk_size=int(limit/50), min_chunk_size=1000)

try:
while True:
Expand Down
1 change: 1 addition & 0 deletions tlscanary/sources_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def iter_chunks(self, chunk_size=None, min_chunk_size=1, chunk_start=0, chunk_st
:param chunk_stop: int
:return: function
"""
chunk_size = int(chunk_size)
self.chunk_start = chunk_start
self.chunk_stop = len(self) if chunk_stop is None else min(chunk_stop, len(self))
self.chunk_size = (self.chunk_stop - self.chunk_start) / 20 if chunk_size is None else chunk_size
Expand Down

0 comments on commit 6b33e90

Please sign in to comment.