Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread Pool getSecretAction when using wildcards. #226

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ target/
.DS_Store
*swp
*scratch*.py

#Ignore MyPy Cache
.mypy_cache/
16 changes: 8 additions & 8 deletions credstash.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,14 +427,14 @@ def getSecretAction(args, region, **session_params):
in listSecrets(region=region,
table=args.table,
**session_params)])
secrets = dict((name,
getSecret(name,
args.version,
region=region,
table=args.table,
context=args.context,
**session_params))
for name in names)

pool = ThreadPool(min(len(names), THREAD_POOL_MAX_SIZE))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to just call getAllSecrets here?

results = pool.map(
lambda credential: getSecret(credential, args.version, region, args.table, args.context, **session_params),
names)
pool.close()
pool.join()
secrets =dict(zip(names, results))
if args.format == "json":
output_func = json.dumps
output_args = {"sort_keys": True,
Expand Down