Skip to content

Commit

Permalink
Delete Nibblets properly
Browse files Browse the repository at this point in the history
  • Loading branch information
originalsouth committed Dec 11, 2024
1 parent dc81654 commit e703325
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions octopoes/octopoes/core/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,14 @@ def save_origin(
if origin.origin_type == OriginType.AFFIRMATION and not any(
other_origin
for other_origin in self.origin_repository.list_origins(
origin_type={OriginType.DECLARATION, OriginType.OBSERVATION, OriginType.INFERENCE},
origin_type={OriginType.DECLARATION, OriginType.OBSERVATION, OriginType.INFERENCE, OriginType.NIBBLET},
valid_time=valid_time,
result=origin.source,
)
if not (other_origin.origin_type == OriginType.INFERENCE and [other_origin.source] == other_origin.result)
if not (
other_origin.origin_type in [OriginType.INFERENCE, OriginType.NIBBLET]
and [other_origin.source] == other_origin.result
)
):
logger.debug("Affirmation source %s seems dangling, deleting", origin.source)
self.ooi_repository.delete_if_exists(origin.source, valid_time)
Expand All @@ -198,7 +201,7 @@ def save_origin(
self.origin_repository.save(origin, valid_time=valid_time)

# Origins that are stale need to be deleted. #3561
if not origin.result and origin.origin_type != OriginType.INFERENCE:
if not origin.result and origin.origin_type not in [OriginType.INFERENCE, OriginType.NIBBLET]:
self.origin_repository.delete(origin, valid_time=valid_time)

def _run_inference(self, origin: Origin, valid_time: datetime) -> None:
Expand Down

0 comments on commit e703325

Please sign in to comment.