Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(hyperscan): Handles the InvalidError exception during db loading. #181

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
mlissner marked this conversation as resolved.
Show resolved Hide resolved
# 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
Loading