Skip to content

Commit

Permalink
Merge pull request #1012 from NYPL-Simplified/russell/update-expirati…
Browse files Browse the repository at this point in the history
…on-check

Update expiration logic for banned books
  • Loading branch information
russellcullen authored Oct 9, 2024
2 parents 0657a2b + 0e6346d commit 781e4e2
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,16 @@ class BookSyncTask(
try {
this.logger.debug("[{}] checking for deletion", existingId.brief())
val dbEntry = bookDatabase.entry(existingId)
val avail = dbEntry.book.entry.availability
val endDate = avail.endDate.getOrNull() ?: continue

if (endDate <= DateTime.now()) {
this.logger.debug("[{}] deleting", existingId.brief())
// Only expire Axis books
val dist = dbEntry.book.entry.distribution
if (dist != "Axis 360") continue
this.logger.debug("[{}] is Axis pub, checking expiration", existingId.brief())

val avail = dbEntry.book.entry.availability
val endDate = avail.endDate.getOrNull()
if (endDate == null || endDate <= DateTime.now()) {
this.logger.debug("[{}] is expired, deleting", existingId.brief())
bookRegistry.clearFor(existingId)
dbEntry.delete()
}
Expand Down

0 comments on commit 781e4e2

Please sign in to comment.