diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2022-04-19 10:46:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-19 09:46:45 +0100 |
commit | 57e3622b85fd4d80d9826404135f09e91ed47973 (patch) | |
tree | ecedc835dfd4b6eb21ff3b028df8f43cfb65a01f /syncapi/syncapi.go | |
parent | 3ddbffd59ece5f74d951d6209882d9d954db4bc3 (diff) |
Implement lazy loading on `/sync` (#2346)
* Initial work on lazyloading
* Partially implement lazy loading on /sync
* Rename methods
* Make missing tests pass
* Preallocate slice, even if it will end up with fewer values
* Let the cache handle the user mapping
* Linter
* Cap cache growth
Diffstat (limited to 'syncapi/syncapi.go')
-rw-r--r-- | syncapi/syncapi.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/syncapi/syncapi.go b/syncapi/syncapi.go index 384121a8..2f9165d9 100644 --- a/syncapi/syncapi.go +++ b/syncapi/syncapi.go @@ -57,8 +57,12 @@ func AddPublicRoutes( } eduCache := caching.NewTypingCache() + lazyLoadCache, err := caching.NewLazyLoadCache() + if err != nil { + logrus.WithError(err).Panicf("failed to create lazy loading cache") + } notifier := notifier.NewNotifier() - streams := streams.NewSyncStreamProviders(syncDB, userAPI, rsAPI, keyAPI, eduCache, notifier) + streams := streams.NewSyncStreamProviders(syncDB, userAPI, rsAPI, keyAPI, eduCache, lazyLoadCache, notifier) notifier.SetCurrentPosition(streams.Latest(context.Background())) if err = notifier.Load(context.Background(), syncDB); err != nil { logrus.WithError(err).Panicf("failed to load notifier ") |