-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: add Agent Manager to utils package #731
feat: add Agent Manager to utils package #731
Conversation
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool idea!
In addition:
|
|
Yes at the top, in
Nvm, my bad. Assumed it was a brand new separate module. All good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, cool stuff. Thanks!
Motivation
It is a simple but useful class to manage multiple HTTP agents associated with identities.
Credits
The original scripts were created by @peterpeterparker in the OISY repo. This is just a transposition to a re-usable utility.
Changes
New
AgentManager
class with:create
method: static constructor.createAgent
method: as the name suggests, it creates a new HTTP but do not cache it.getAgent
method: it fetches the HTTP agent among the cached, and if does note exists, it creates it and cache it.clearAgents
method: clean slate.Tests
I created a few tests for the few usecases.
Todos