Disable inactive club sites #68

Merged
r389li merged 8 commits from disable-inactive-club-sites into master 2022-07-22 23:52:01 -04:00
1 changed files with 17 additions and 9 deletions
Showing only changes of commit de02171caa - Show all commits

View File

@ -44,20 +44,28 @@ class ClubWebHostingService:
self.lock = Lock()
@contextlib.contextmanager
def begin_transaction(self):
self.lock.acquire()
def _hold_lock(self):
try:
self.aug = Augeas(self.aug_root)
self._get_club_emails()
self._get_disabled_sites()
self.lock.acquire()
yield
finally:
self.aug.close()
self.aug = None
self.clubs.clear()
self.made_at_least_one_change = False
self.lock.release()
@contextlib.contextmanager
def begin_transaction(self):
with self._hold_lock():
try:
self.aug = Augeas(self.aug_root)
self._get_club_emails()
self._get_disabled_sites()
yield
finally:
if self.aug is not None:
self.aug.close()
self.aug = None
self.clubs.clear()
self.made_at_least_one_change = False
def _run(self, args: List[str], **kwargs):
subprocess.run(args, check=True, **kwargs)