reference-cache-integrity-fix-2 (#1645)
* delete from process caller table explicitly before removing from reference cache to hopefully avoid integrity errors * check if reference cache id list has items to avoid unnecessary db calls --------- Co-authored-by: jasquat <jasquat@users.noreply.github.com> Co-authored-by: Kevin Burnett <18027+burnettk@users.noreply.github.com>
This commit is contained in:
parent
be68db52ba
commit
2992798c5b
|
@ -20,13 +20,14 @@ class ProcessCallerService:
|
|||
|
||||
@staticmethod
|
||||
def clear_cache_for_process_ids(reference_cache_ids: list[int]) -> None:
|
||||
# query-invoked autoflush happens here
|
||||
ProcessCallerRelationshipModel.query.filter(
|
||||
or_(
|
||||
ProcessCallerRelationshipModel.called_reference_cache_process_id.in_(reference_cache_ids),
|
||||
ProcessCallerRelationshipModel.calling_reference_cache_process_id.in_(reference_cache_ids),
|
||||
)
|
||||
).delete()
|
||||
if len(reference_cache_ids) > 0:
|
||||
# query-invoked autoflush happens here
|
||||
ProcessCallerRelationshipModel.query.filter(
|
||||
or_(
|
||||
ProcessCallerRelationshipModel.called_reference_cache_process_id.in_(reference_cache_ids),
|
||||
ProcessCallerRelationshipModel.calling_reference_cache_process_id.in_(reference_cache_ids),
|
||||
)
|
||||
).delete()
|
||||
|
||||
@staticmethod
|
||||
def add_caller(calling_process_identifier: str, called_process_identifiers: list[str]) -> None:
|
||||
|
|
|
@ -276,6 +276,10 @@ class SpecFileService(FileSystemService):
|
|||
reference_cache_ids = []
|
||||
for record in records:
|
||||
reference_cache_ids.append(record.id)
|
||||
|
||||
ProcessCallerService.clear_cache_for_process_ids(reference_cache_ids)
|
||||
|
||||
for record in records:
|
||||
db.session.delete(record)
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue