From 62a889bb1c1560badd77de2efcb4d5e5cc5ef063 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Thu, 6 Jan 2022 17:20:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86action=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/action.go | 2 +- services/socketwrap/clientManager.go | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/models/action.go b/models/action.go index 8b077e6ca4..e2958821c2 100755 --- a/models/action.go +++ b/models/action.go @@ -354,7 +354,7 @@ func GetLast20PublicFeeds() ([]*Action, error) { actions := make([]*Action, 0, 20) - if err := x.Limit(20).Desc("id").Where(cond).Find(&actions); err != nil { + if err := x.Limit(30).Desc("id").Where(cond).Find(&actions); err != nil { return nil, fmt.Errorf("Find: %v", err) } diff --git a/services/socketwrap/clientManager.go b/services/socketwrap/clientManager.go index 7692c815ed..eeb496108a 100644 --- a/services/socketwrap/clientManager.go +++ b/services/socketwrap/clientManager.go @@ -26,7 +26,7 @@ func NewClientsManager() *ClientsManager { const MaxClients = 100 -var LastActionsQueue = NewSyncQueue(11) +var LastActionsQueue = NewSyncQueue(15) func (h *ClientsManager) Run() { initActionQueue() @@ -75,7 +75,15 @@ func initActionQueue() { actions, err := models.GetLast20PublicFeeds() if err == nil { for i := len(actions) - 1; i >= 0; i-- { - LastActionsQueue.Push(actions[i]) + + user, err := models.GetUserByID(actions[i].UserID) + if err == nil { + if !user.IsOrganization() { + LastActionsQueue.Push(actions[i]) + } + + } + } } } -- 2.34.1