-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #967 from cderici/optimize-fix-destroy-units-issue950
#967 #### Description This change does two things: 1. Fixes the #950 as @addyess suggested. 2. Optimizes the `model.destroy_units` where currently we're calling the API (`ApplicationFacade.DestroyUnits`) for each unit to be destroyed. This changes it so that the API is called only once with the list of the units. Fixes #950 #### QA Steps Added an integration test for the first case: ``` tox -e integration -- tests/integration/test_unit.py::test_destroy_unit ``` For the `model.destroy_units()` we already have a test: ``` tox -e integration -- tests/integration/test_model.py::test_destroy_units ``` Additionally, we also have a bunch of tests that use the `model.destroy_units()`, so they should be passing as well in the CI. All CI tests need to pass. #### Notes & Discussion Normally it should be the case where the `model.destroy_units()` would use the `Unit.destroy()` on the Unit object. However, doing that for multiple units would be either inefficient (call `u.destroy()` for each unit -- thereby having the same inefficiency that we currently have), or a bit awkward since a unit would be requesting removal for other units. That's why we keep the `model.destroy_units`, as well as the `unit.destroy()` essentially doing the same thing.
- Loading branch information
Showing
3 changed files
with
47 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters