Enhance bot management with Len method and export Managed type#467
Open
anhnmt wants to merge 2 commits into
Open
Enhance bot management with Len method and export Managed type#467anhnmt wants to merge 2 commits into
anhnmt wants to merge 2 commits into
Conversation
Make bot management accessible from outside the pool package by exporting the Managed type, renaming acquire/start to Acquire/Start, and adding a Bot() accessor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two small extensions to the pool package needed by downstream
consumers that manage bots outside of Pool.Do:
Pool.Len() returns the number of bots currently tracked by the pool.
Useful for monitoring/metrics and health checks that need visibility
into pool size without reaching into internals.
Managed is now exported, along with its Bot() accessor. Some
consumers need to hold a reference to a specific managed bot (e.g.
for per-bot lifecycle tracking, activity logging, or diagnostics)
rather than only invoking it through Pool.Do's callback style.
Bot() returns the underlying *botapi.Bot without waiting for
readiness; callers that need a ready/authorized bot should still go
through Pool.Do, which blocks on the ready channel before invoking
the callback. Bot() is intended for read-only access where the
caller already knows the bot's state (e.g. it was reached via Do).
No behavioral changes to existing Pool semantics — this only widens
the public surface.