Skip to content

Commit

Permalink
Remove locked_date_for_update and manually clear the date_locked
Browse files Browse the repository at this point in the history
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 b87a639
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions bodhi/server/consumers/masher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b87a639

Please sign in to comment.