Skip to content
Permalink
Browse files

Remove locked_date_for_update and manually clear the date_locked

This function was used to clear up a mess that should never have been caused:
the case where an update is locked without a date_locked, or it is not locked
and it has a date_locked.
Instead, we now just set and unset date_locked with the locked attribute.

Since commit 354d208, this code has been doing
nothing anyway, because at that point of the code, self.updates is still an empty
set: it will only be filled during the self.load_updates call later in the work()
function.

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
  • Loading branch information...
puiterwijk committed Sep 22, 2016
1 parent 1951467 commit b87a6395fba6d6ef7d0851e3835e31424635177c
Showing with 1 addition and 18 deletions.
  1. +1 −18 bodhi/server/consumers/masher.py
@@ -276,9 +276,6 @@ def results(self):
# src=src, dest=dest, nvr=nvr)

def work(self):
# Update datetime for locking on update
self.locked_date_for_update()

self.koji = buildsys.get_session()
self.release = self.db.query(Release)\
.filter_by(name=self.release).one()
@@ -406,23 +403,9 @@ def unlock_updates(self):
self.log.debug('Unlocking updates')
for update in self.updates:
update.locked = False
update.date_locked = None
self.db.flush()

def locked_date_for_update(self):
""" Return the date & time when an update has been locked """
for update in self.updates:
# Return datetime when an update is locked and datetime is
# not yet assigned to the column date_locked
if update.locked and not update.date_locked:
update.date_locked = datetime.utcnow()
self.db.commit()
self.db.refresh(update)
return update.date_locked
# Reset the column date_locked to None when an update gets unlocked
elif not update.locked and update.date_locked:
update.date_locked = None
self.db.commit()

def check_all_karma_thresholds(self):
"""
If we just pushed testing updates see if any of them now meet either of

0 comments on commit b87a639

Please sign in to comment.
You can’t perform that action at this time.