Skip to content

Commit

Permalink
aws - elasticsearch - regression fix augment batch size (#5796)
Browse files Browse the repository at this point in the history
  • Loading branch information
kapilt committed May 26, 2020
1 parent 48812b9 commit cd6a016
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions c7n/resources/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from c7n.filters.vpc import SecurityGroupFilter, SubnetFilter, VpcFilter
from c7n.manager import resources
from c7n.query import ConfigSource, DescribeSource, QueryResourceManager, TypeInfo
from c7n.utils import local_session, type_schema
from c7n.utils import chunks, local_session, type_schema
from c7n.tags import Tag, RemoveTag, TagActionFilter, TagDelayedAction

from .securityhub import PostFinding
Expand All @@ -34,6 +34,7 @@ def get_resources(self, resource_ids):
def augment(self, domains):
client = local_session(self.manager.session_factory).client('es')
model = self.manager.get_model()
results = []

def _augment(resource_set):
resources = self.manager.retry(
Expand All @@ -45,7 +46,10 @@ def _augment(resource_set):
client.list_tags, ARN=rarn).get('TagList', [])
return resources

return _augment(domains)
for resource_set in chunks(domains, 5):
results.extend(_augment(resource_set))

return results


@resources.register('elasticsearch')
Expand Down

0 comments on commit cd6a016

Please sign in to comment.