diff options
| author | 2025-03-05 19:12:53 +0100 | |
|---|---|---|
| committer | 2025-03-05 19:12:53 +0100 | |
| commit | 69461c461b79dbeb9b55ba83d2b7308772194d7f (patch) | |
| tree | 481f39bd01ded500989faa658069db6cc0fce7dc /internal/cache/cache.go | |
| parent | [feature] Add token review / delete to backend + settings panel (#3845) (diff) | |
| download | gotosocial-69461c461b79dbeb9b55ba83d2b7308772194d7f.tar.xz | |
[bugfix] Return useful err on `server start` failure (#3879)
* [bugfix] Return useful err on `server start` failure
* remove scheduler started func
* remove tryUntil
Diffstat (limited to 'internal/cache/cache.go')
| -rw-r--r-- | internal/cache/cache.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/internal/cache/cache.go b/internal/cache/cache.go index e57fbb569..88e4f870a 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -23,6 +23,7 @@ import ( "codeberg.org/gruf/go-cache/v3/ttl" "github.com/superseriousbusiness/gotosocial/internal/cache/headerfilter" "github.com/superseriousbusiness/gotosocial/internal/config" + "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/log" ) @@ -124,16 +125,18 @@ func (c *Caches) Init() { // Start will start any caches that require a background // routine, which usually means any kind of TTL caches. -func (c *Caches) Start() { +func (c *Caches) Start() error { log.Infof(nil, "start: %p", c) - tryUntil("starting webfinger cache", 5, func() bool { - return c.Webfinger.Start(5 * time.Minute) - }) + if !c.Webfinger.Start(5 * time.Minute) { + return gtserror.New("could not start webfinger cache") + } - tryUntil("starting statusesFilterableFields cache", 5, func() bool { - return c.StatusesFilterableFields.Start(5 * time.Minute) - }) + if !c.StatusesFilterableFields.Start(5 * time.Minute) { + return gtserror.New("could not start statusesFilterableFields cache") + } + + return nil } // Stop will stop any caches that require a background @@ -141,8 +144,8 @@ func (c *Caches) Start() { func (c *Caches) Stop() { log.Infof(nil, "stop: %p", c) - tryUntil("stopping webfinger cache", 5, c.Webfinger.Stop) - tryUntil("stopping statusesFilterableFields cache", 5, c.StatusesFilterableFields.Stop) + _ = c.Webfinger.Stop() + _ = c.StatusesFilterableFields.Stop() } // Sweep will sweep all the available caches to ensure none |
