diff options
author | 2021-09-11 13:19:06 +0200 | |
---|---|---|
committer | 2021-09-11 13:19:06 +0200 | |
commit | 9dc2255a8fab8ef0bc4b9f417c6131e4c468cb9c (patch) | |
tree | ae528bf14a3475bbea264ff26e5ffded3dfadf8a /internal/typeutils | |
parent | Test both dbs (#205) (diff) | |
download | gotosocial-9dc2255a8fab8ef0bc4b9f417c6131e4c468cb9c.tar.xz |
kim is a reply guy (#208)
* bun debug
* bun trace logging hooks
* more tests
* fix up some stuffffff
* drop the frontend cache until a proper fix is made
* go fmt
Diffstat (limited to 'internal/typeutils')
-rw-r--r-- | internal/typeutils/converter.go | 18 | ||||
-rw-r--r-- | internal/typeutils/internaltofrontend.go | 13 |
2 files changed, 8 insertions, 23 deletions
diff --git a/internal/typeutils/converter.go b/internal/typeutils/converter.go index 630e48300..40cb5b969 100644 --- a/internal/typeutils/converter.go +++ b/internal/typeutils/converter.go @@ -178,20 +178,18 @@ type TypeConverter interface { } type converter struct { - config *config.Config - db db.DB - log *logrus.Logger - frontendCache cache.Cache - asCache cache.Cache + config *config.Config + db db.DB + log *logrus.Logger + asCache cache.Cache } // NewConverter returns a new Converter func NewConverter(config *config.Config, db db.DB, log *logrus.Logger) TypeConverter { return &converter{ - config: config, - db: db, - log: log, - frontendCache: cache.New(), - asCache: cache.New(), + config: config, + db: db, + log: log, + asCache: cache.New(), } } diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index 7924e2185..67d6cef94 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -67,14 +67,6 @@ func (c *converter) AccountToMastoPublic(ctx context.Context, a *gtsmodel.Accoun return nil, fmt.Errorf("given account was nil") } - // first check if we have this account in our frontEnd cache - if accountI, err := c.frontendCache.Fetch(a.ID); err == nil { - if account, ok := accountI.(*model.Account); ok { - // we have it, so just return it as-is - return account, nil - } - } - // count followers followersCount, err := c.db.CountAccountFollowedBy(ctx, a.ID, false) if err != nil { @@ -184,11 +176,6 @@ func (c *converter) AccountToMastoPublic(ctx context.Context, a *gtsmodel.Accoun Suspended: suspended, } - // put the account in our cache in case we need it again soon - if err := c.frontendCache.Store(a.ID, accountFrontend); err != nil { - return nil, err - } - return accountFrontend, nil } |