Skip to content

Commit

Permalink
[6.12.z] Add in the caching mechanism to the Satellite's api property (
Browse files Browse the repository at this point in the history
…#12772)

Add in the caching mechanism to the Satellite's api property (#12765)

This should have always existed but was overlooked. It will dramatically
decrease the amount of time it takes to access the api property since
it doesn't need to be reconstructed each time the property is accessed.

Before
------
%timeit mysat.api.Host
3.62 ms ± 52.4 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

After
-----
%timeit mysat.api.Host
189 ns ± 0.943 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)

(cherry picked from commit b3d32b6)

Co-authored-by: Jake Callahan <[email protected]>
  • Loading branch information
Satellite-QE and JacobCallahan authored Sep 28, 2023
1 parent 2d86587 commit 9498d3c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,7 @@ def cli(self):
except AttributeError:
# not everything has an mro method, we don't care about them
pass
self._cli._configured = True
return self._cli


Expand Down Expand Up @@ -1683,6 +1684,7 @@ class DecClass(cls):
except AttributeError:
# not everything has an mro method, we don't care about them
pass
self._api._configured = True
return self._api

@property
Expand All @@ -1705,6 +1707,7 @@ def cli(self):
except AttributeError:
# not everything has an mro method, we don't care about them
pass
self._cli._configured = True
return self._cli

def ui_session(self, testname=None, user=None, password=None, url=None, login=True):
Expand Down

0 comments on commit 9498d3c

Please sign in to comment.