Skip to content

Commit

Permalink
Fixes context manager issue by removing a session commit buried in th…
Browse files Browse the repository at this point in the history
…e call stack.
  • Loading branch information
dbernstein committed Dec 19, 2024
1 parent 2bf2cb0 commit 2de1542
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/palace/manager/sqlalchemy/model/licensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,16 +1656,12 @@ def delete(self):
pools = list(self.license_pools)
_db.delete(self)

# TODO: We need to explicitly commit here so that
# LicensePool.delivery_mechanisms gets updated. It would be
# better if we didn't have to do this, but I haven't been able
# to get LicensePool.delivery_mechanisms to notice that it's
# out of date.
_db.commit()

# The deletion of a LicensePoolDeliveryMechanism might affect
# the open-access status of its associated LicensePools.
for pool in pools:
# We need to expire pool here otherwise the delivery_mechanisms
# will contain a stale reference to the deleted licensepooldeliverymechanism
_db.expire(pool)
# The deletion of a LicensePoolDeliveryMechanism might affect
# the open-access status of its associated LicensePools.
pool.set_open_access_status()

def set_rights_status(self, uri):
Expand Down

0 comments on commit 2de1542

Please sign in to comment.