Skip to content

Commit

Permalink
Revert "try verifying indexing directly in test_api"
Browse files Browse the repository at this point in the history
This reverts commit f27623d.
  • Loading branch information
prenner committed Oct 2, 2024
1 parent f27623d commit 89f5c7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,16 @@ def index_cache_is_stale() -> bool:
def _get_index(signal_type: t.Type[SignalType]) -> SignalTypeIndex[int] | None:
entry = _get_index_cache().get(signal_type.get_name())

if entry is not None and is_in_pytest():
entry.reload_if_needed(get_storage())

if entry is None:
current_app.logger.debug("[lookup_signal] no cache, loading index")
return get_storage().get_signal_type_index(signal_type)
if entry.is_ready:
return entry.index
return None


def is_in_pytest():
return "pytest" in sys.modules
3 changes: 0 additions & 3 deletions hasher-matcher-actioner/src/OpenMediaMatch/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import typing as t

from OpenMediaMatch.blueprints.matching import IndexCache, _get_index_cache
from flask.testing import FlaskClient
from flask import Flask

Expand Down Expand Up @@ -193,8 +192,6 @@ def test_banks_add_hash_index(app: Flask, client: FlaskClient):

# Build index
build_all_indices(storage, storage, storage)
cache = _get_index_cache().get("pdq")
cache.reload_if_needed(get_storage())

# Test against first image
post_response = client.get(
Expand Down

0 comments on commit 89f5c7d

Please sign in to comment.