Fix the queue item delete.

This commit is contained in:
Charlton Austin 2016-12-02 15:07:03 -05:00
parent d6e14f170c
commit 0a6322015c
2 changed files with 2 additions and 7 deletions

View file

@ -213,8 +213,7 @@ class WorkQueue(object):
def cancel(self, item_id):
""" Attempts to cancel the queue item with the given ID from the queue. Returns true on success
and false if the queue item could not be canceled. A queue item can only be canceled if
if is available and has retries remaining.
and false if the queue item could not be canceled.
"""
with self._transaction_factory(db):
@ -225,10 +224,6 @@ class WorkQueue(object):
except QueueItem.DoesNotExist:
return False
# Check the queue item.
if not queue_item.available or queue_item.retries_remaining == 0:
return False
# Delete the queue item.
queue_item.delete_instance(recursive=True)
return True

View file

@ -2317,7 +2317,7 @@ class TestRepositoryBuildResource(ApiTestCase):
# Try to cancel the build.
self.deleteResponse(RepositoryBuildResource,
params=dict(repository=ADMIN_ACCESS_USER + '/simple', build_uuid=uuid),
expected_code=400)
expected_code=201)
def test_attemptcancel_workingbuild(self):