Skip to content

Commit

Permalink
Merge pull request #181 from freelawproject/fix-handle-invalid-error-…
Browse files Browse the repository at this point in the history
…while-loading-db

fix(hyperscan): Handles the InvalidError exception during db loading.
  • Loading branch information
mlissner authored May 23, 2024
2 parents 062b2c2 + 667fae5 commit d844d93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Changes:
- None

Fixes:
- None
- Strengthens error handling during the loading of the cached Hyperscan database. This ensures that an invalid cache triggers a rebuild.


## Current
Expand Down
6 changes: 6 additions & 0 deletions eyecite/tokenizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ def convert_regex(regex):
)
except TypeError:
hyperscan_db = hyperscan.loadb(cache_bytes)
except hyperscan.InvalidError:
# Skipping hyperscan_db assignment to force a full
# database recompile as the cached version seems to be
# invalid.
pass

try:
# at some point Scratch became necessary --
# https://github.com/darvid/python-hyperscan/issues/50#issuecomment-1386243477
Expand Down

0 comments on commit d844d93

Please sign in to comment.