Skip to content

Commit

Permalink
[Resolve #1263] Stack output caching (#1312)
Browse files Browse the repository at this point in the history
This PR caches the stack outputs of each cache so that we're not making redundant requests for the same stack outputs over and over again (which is what we currently do now in every instance we use !stack_output or !stack_output_external).

Thanks to @dboitnot for the very simple solution suggestion!

(I've not written any tests because I believe that if existing unit and integration tests pass, this should be considered very "safe".)
  • Loading branch information
jfalkenstein committed Feb 26, 2023
1 parent 5f6adaa commit 0ab1c4a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sceptre/resolvers/stack_output.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
# -*- coding: utf-8 -*-

import abc
import six
import functools
import logging
import shlex

from botocore.exceptions import ClientError

from sceptre.exceptions import DependencyStackMissingOutputError, StackDoesNotExistError
from sceptre.helpers import normalise_path, sceptreise_path
from sceptre.resolvers import Resolver
from sceptre.exceptions import DependencyStackMissingOutputError
from sceptre.exceptions import StackDoesNotExistError

TEMPLATE_EXTENSION = ".yaml"


@six.add_metaclass(abc.ABCMeta)
class StackOutputBase(Resolver):
"""
A abstract base class which provides methods for getting Stack outputs.
Expand Down Expand Up @@ -50,6 +47,7 @@ def _get_output_value(
)
)

@functools.lru_cache(maxsize=4096)
def _get_stack_outputs(
self, stack_name, profile=None, region=None, sceptre_role=None
):
Expand Down

0 comments on commit 0ab1c4a

Please sign in to comment.