Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Trzcinska <[email protected]>
  • Loading branch information
annatrz committed Nov 15, 2019
1 parent 76c4a15 commit 43fbd01
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cap/modules/schemas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from invenio_access.permissions import authenticated_user
from invenio_cache import current_cache
from invenio_db import db
from invenio_jsonschemas import current_jsonschemas
from invenio_jsonschemas.errors import JSONSchemaNotFound
from invenio_search import current_search
from invenio_search import current_search_client as es
Expand Down Expand Up @@ -340,6 +341,14 @@ def after_record_mapping_updated(target, value, oldvalue, initiator):
_recreate_record_mapping_in_ES(target, value)


@event.listens_for(Schema, 'after_update')
def after_update(target, value, schema):
"""."""
mappings_imp = current_app.config.get('SEARCH_GET_MAPPINGS_IMP')
current_cache.delete_memoized(import_string(mappings_imp))
current_jsonschemas._get_schema_cached.cache_clear()


@event.listens_for(Schema, 'after_delete')
def before_delete_schema(mapper, connect, schema):
"""On schema delete, delete corresponding indexes and aliases in ES."""
Expand Down

0 comments on commit 43fbd01

Please sign in to comment.