Merge pull request #2192 from charltonaustin/fix_queue_item_delete
Fix the queue item delete.
This commit is contained in:
commit
52dfd82031
2 changed files with 2 additions and 7 deletions
|
@ -213,8 +213,7 @@ class WorkQueue(object):
|
||||||
|
|
||||||
def cancel(self, item_id):
|
def cancel(self, item_id):
|
||||||
""" Attempts to cancel the queue item with the given ID from the queue. Returns true on success
|
""" 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
|
and false if the queue item could not be canceled.
|
||||||
if is available and has retries remaining.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
with self._transaction_factory(db):
|
with self._transaction_factory(db):
|
||||||
|
@ -225,10 +224,6 @@ class WorkQueue(object):
|
||||||
except QueueItem.DoesNotExist:
|
except QueueItem.DoesNotExist:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check the queue item.
|
|
||||||
if not queue_item.available or queue_item.retries_remaining == 0:
|
|
||||||
return False
|
|
||||||
|
|
||||||
# Delete the queue item.
|
# Delete the queue item.
|
||||||
queue_item.delete_instance(recursive=True)
|
queue_item.delete_instance(recursive=True)
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -2317,7 +2317,7 @@ class TestRepositoryBuildResource(ApiTestCase):
|
||||||
# Try to cancel the build.
|
# Try to cancel the build.
|
||||||
self.deleteResponse(RepositoryBuildResource,
|
self.deleteResponse(RepositoryBuildResource,
|
||||||
params=dict(repository=ADMIN_ACCESS_USER + '/simple', build_uuid=uuid),
|
params=dict(repository=ADMIN_ACCESS_USER + '/simple', build_uuid=uuid),
|
||||||
expected_code=400)
|
expected_code=201)
|
||||||
|
|
||||||
|
|
||||||
def test_attemptcancel_workingbuild(self):
|
def test_attemptcancel_workingbuild(self):
|
||||||
|
|
Reference in a new issue