Skip to content

Commit

Permalink
Delete Identity Map
Browse files Browse the repository at this point in the history
  • Loading branch information
everysoftware committed Dec 21, 2024
1 parent 29b87fb commit f81cce7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/enterprise/unit_of_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def __init__(self, source: DataSource) -> None:
self._new: list[Entity] = []
self._dirty: list[Entity] = []
self._removed: list[Entity] = []
self._all: dict[str, dict[int, Entity]] = {}

@property
def source(self) -> DataSource:
Expand All @@ -76,7 +75,6 @@ def get[T: Entity](self, entity_type: type[T], id: int) -> T | None:
if data is None:
return None
entity = entity_type(**data) # noqa
self._all.setdefault(entity_type.__name__, {})[id] = entity
return entity

def update(self, model: Entity) -> None:
Expand Down Expand Up @@ -108,6 +106,7 @@ def commit(self) -> None:

def rollback(self) -> None:
self._source.rollback()
self._identity_map.clear()
self._new.clear()
self._dirty.clear()
self._removed.clear()

0 comments on commit f81cce7

Please sign in to comment.