Skip to content

Commit

Permalink
fix fuzzy function name and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
gamoutatsumi committed Apr 16, 2024
1 parent e7fe1bb commit a1e9b3e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pool-agent/cmd/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (a *Agent) Run(ctx context.Context, sigHupCh chan os.Signal) error {
slog.Info("Received SIGHUP. Reloading config...")
a.reloadConfig()
case <-ticker.C:
if err := a.checkInstances(); err != nil {
if err := a.adjustInstancePool(); err != nil {
slog.Error("failed to check instances", "err", err.Error())
}
if err := prometheus.WriteToTextfile(metricsPath, a.registry); err != nil {
Expand Down Expand Up @@ -173,7 +173,9 @@ func generateInstanceName() (string, error) {
return fmt.Sprintf("myshoes-runner-%x", b), nil
}

func (a *Agent) checkInstances() error {
// adjustInstancePool adjusts the instance pool.
// It creates or deletes instances according to the configuration.
func (a *Agent) adjustInstancePool() error {
s, err := a.Client.GetInstances(api.InstanceTypeAny)
if err != nil {
return fmt.Errorf("get instances: %w", err)
Expand Down

0 comments on commit a1e9b3e

Please sign in to comment.