()
| 105 | } |
| 106 | |
| 107 | func (t *toolsUpdater) updateTools() error { |
| 108 | slog.DebugContext(t.ctx, "updating tools", "last_update", t.lastUpdate, "entity", t.entity.String(), "forge_type", t.entity.Credentials.ForgeType) |
| 109 | entity, ok := cache.GetEntity(t.entity.ID) |
| 110 | if !ok { |
| 111 | return fmt.Errorf("getting entity from cache: %s", t.entity.ID) |
| 112 | } |
| 113 | ghCli, err := github.Client(t.ctx, entity) |
| 114 | if err != nil { |
| 115 | return fmt.Errorf("getting github client: %w", err) |
| 116 | } |
| 117 | |
| 118 | tools, err := garmUtil.FetchTools(t.ctx, ghCli) |
| 119 | if err != nil { |
| 120 | return fmt.Errorf("error fetching tools: %w", err) |
| 121 | } |
| 122 | |
| 123 | if len(tools) == 0 { |
| 124 | return fmt.Errorf("FetchTools returned no tools") |
| 125 | } |
| 126 | |
| 127 | t.tools = tools |
| 128 | |
| 129 | slog.DebugContext(t.ctx, "updating tools cache", "entity", t.entity.String()) |
| 130 | cache.SetGithubToolsCache(entity, tools) |
| 131 | return nil |
| 132 | } |
| 133 | |
| 134 | func (t *toolsUpdater) Reset() { |
| 135 | t.mux.Lock() |
no test coverage detected