Skip to content

performance check: findings for azd-rest #104

@jongio

Description

@jongio

performance check

  • maxPages global variable in cli/src/internal/cmd/root.go is never registered as a Cobra persistent flag (--max-pages), so Config.MaxPages is always 0 (Go zero value) instead of the intended default of 100 defined in config.Defaults(). With --paginate enabled, this means the page cap is silently 0, potentially allowing unbounded page traversal depending on how the underlying httpclient handles a zero MaxPages value. Fix: add rootCmd.PersistentFlags().IntVar(&maxPages, "max-pages", 100, "Maximum pages to fetch when paginating") in NewRootCmd().
  • service.Execute() in cli/src/internal/service/service.go (line 152) creates a new HTTP client (s.httpClientFactory(...)) on every invocation, bypassing connection pool reuse across calls. The MCP path correctly caches the HTTP client via getOrCreateHTTPClient(). For the CLI path, consider caching or reusing the client (e.g. store it on RequestService) to benefit from keep-alive connections when multiple requests are issued in scripts/pipelines.
  • skills.InstallSkill() is called unconditionally on every command invocation via PersistentPreRunE in cli/src/internal/cmd/root.go. If the underlying install writes a file on each call, this adds unnecessary disk I/O overhead. Fix: add a version-gated check inside InstallSkill() (or before calling it) to skip the write when the installed version already matches the current version.

Automated analysis - 3 finding(s)

Metadata

Metadata

Assignees

No one assigned

    Labels

    automatedFiled by automated analysis

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions