Files
stpweb/backend/graph/gitea.resolvers.go
adamfandClaude Opus 5.5 4530cb8dc4
Test and deploy / test (push) Successful in 28s
Test and deploy / deploy (push) Successful in 31s
Trim comments to the non-obvious why
Drop narration, history and restated-code comments across the repo,
keep short ones for security boundaries, upstream quirks and ordering
constraints, and record the convention in CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 20:49:03 +00:00

36 lines
998 B
Go

package graph
// This file will be automatically regenerated based on the schema, any resolver
// implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.98
import (
"context"
"adam-french.co.uk/backend/graph/model"
"adam-french.co.uk/backend/services"
)
// GiteaFeed is the resolver for the giteaFeed field.
func (r *queryResolver) GiteaFeed(ctx context.Context) (*model.GiteaFeedItem, error) {
// One-minute cache on the Store, shared by every visitor, so a busy home
// page does not hammer the Gitea container.
if cached, ok := r.Store.CachedGiteaFeed(); ok {
return mapGiteaFeed(cached), nil
}
feed, err := services.FetchLatestFeed(r.Store.GiteaHost, r.Store.GiteaPort)
if err != nil {
return nil, err
}
// Not cached, so an empty feed is retried next time.
if feed == nil {
return nil, nil
}
r.Store.SetGiteaFeed(feed)
return mapGiteaFeed(feed), nil
}