Skip to content

pregenFetch makes expensive API call but discards the result #77

@claude

Description

@claude

In cmd/pregen.go:115-135, the pregenFetch fallback function is called when the SQLite cache is unavailable (DB path error or open error). It creates a 20-minute context, zips the repo, and calls the API -- but then discards the returned graph:

_, err = fetchGraphWithCircularDeps(ctx, apiClient, proj.Name, zipData, logFn)

Since pregen's entire purpose is to warm the local cache, fetching without being able to store the result provides zero benefit. The function wastes up to 20 minutes of network time and API resources on a call whose output is thrown away.

The two call sites in cmd/pregen.go (lines 65 and 71):

  • line 65: fallback when config.DBPath() fails
  • line 71: fallback when cache.Open() fails

Fix: If the cache is unavailable, log a warning and return early rather than making a pointless API call. pregenFetch should be removed or replaced with a short-circuit.

@claude please implement this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions