[MM-44488] Cloud limits: enforcing messages (#20362)

* Add new Job to keep updating the last_accessible_post time

* Filter out posts for funcs returning PostList model

* Separate methods to get and compute cache

* filter pinned posts

* For posts with sorted CreateAt order, support a faster form of filtering.

* Add inaccessible header for getPost and getPostsByIDs APIs

* replace manual binary search with the std. library

* in-place filter posts

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Nathaniel Allred <neallred@protonmail.com>
Этот коммит содержится в:
Vishal
2022-07-06 11:56:39 +05:30
коммит произвёл GitHub
родитель c62d4bee5f
Коммит e5ee5eecd8
26 изменённых файлов: 1253 добавлений и 45 удалений

Просмотреть файл

@@ -5146,6 +5146,22 @@ func (s *TimerLayerPostStore) GetMaxPostSize() int {
return result
}
func (s *TimerLayerPostStore) GetNthRecentPostTime(n int64) (int64, error) {
start := time.Now()
result, err := s.PostStore.GetNthRecentPostTime(n)
elapsed := float64(time.Since(start)) / float64(time.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetNthRecentPostTime", success, elapsed)
}
return result, err
}
func (s *TimerLayerPostStore) GetOldest() (*model.Post, error) {
start := time.Now()