Skip to content

Commit 8135dd0

Browse files
committed
Fix OPDS circulation-only updates being skipped after hash-based detection
The `opds_import_task` was not passing `apply_circulation` to `importer.import_feed`, making the fallback path for "bibliographic unchanged, circulation changed" completely dead code. Pass `apply.circulation_apply.delay` to restore that path. Add a `needs_apply` guard to the `elif` branch in `import_feed_from_response` so `apply_circulation` is only queued when the circulation data has actually changed, preventing redundant tasks on every re-import of unchanged content. Fix `CirculationData.needs_apply` to always return `True` when `self.licenses` is not None (ODL-style pools). License expiry is time-dependent and cannot be detected by content hashing alone; this mirrors the existing exception already present in the `apply()` early- return guard.
1 parent cc3257d commit 8135dd0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/palace/manager/data_layer/circulation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,16 @@ def needs_apply(self, session: Session, collection: Collection) -> bool:
395395
for this object's primary identifier in *collection* and delegates to
396396
:meth:`~palace.manager.data_layer.base.mutable.BaseMutableData.should_apply_to`.
397397
398+
ODL-style pools that carry individual :attr:`licenses` are always considered to
399+
need application because license availability can change over time as licenses expire
400+
independently of any feed content change, and that expiry cannot be detected by
401+
content hashing alone.
402+
398403
:param session: Active database session used to look up the pool.
399404
:param collection: The collection the pool belongs to.
400405
:return: ``True`` if the data needs to be applied, ``False`` if it can be skipped.
401406
"""
407+
if self.licenses is not None:
408+
return True
402409
pool, _ = self.license_pool(session, collection, autocreate=False)
403410
return self.should_apply_to(pool)

0 commit comments

Comments
 (0)