Skip to content

Commit af90134

Browse files
authored
Merge pull request #491 from hubmapconsortium/yuanzhou/fix-cache
Add more debug logging for cache
2 parents 1959190 + f0678ca commit af90134

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.23
1+
2.1.24

src/app.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,15 +1440,21 @@ def update_entity(id):
14401440
cache_key = f'{MEMCACHED_PREFIX}{id}'
14411441
memcached_client_instance.delete(cache_key)
14421442

1443+
logger.info(f"Deleted cache of key: {cache_key} after entity update via PUT call")
1444+
14431445
# Also delete the cache of all the direct descendants (children)
14441446
# Otherwise they'll have old cached data for the `direct_ancestor` (Sample) `direct_ancestors` (Dataset) fields
14451447
# Note: must use uuid in the Neo4j query
14461448
children_uuid_list = schema_neo4j_queries.get_children(neo4j_driver_instance, entity_dict['uuid'] , 'uuid')
1449+
1450+
logger.info(f"Also delete the cache of all the direct descendants (children) of {id} if exist")
14471451

14481452
for child_uuid in children_uuid_list:
14491453
cache_key = f'{MEMCACHED_PREFIX}{child_uuid}'
14501454
memcached_client_instance.delete(cache_key)
14511455

1456+
logger.info(f"Deleted direct descendant cache of key: {cache_key}")
1457+
14521458
# Also reindex the updated entity node in elasticsearch via search-api
14531459
if entity_dict['entity_type'] in ['Collection']:
14541460
logger.log(logging.DEBUG
@@ -4463,6 +4469,7 @@ def query_target_entity(id, user_token):
44634469
internal_server_error(e.response.text)
44644470
else:
44654471
logger.info(f'Using the cache data of entity {id} at time {current_datetime}')
4472+
logger.debug(entity_dict)
44664473

44674474
# Final return
44684475
return entity_dict

0 commit comments

Comments
 (0)