mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-01 13:12:24 -05:00
remove unnecessary change
This commit is contained in:
parent
227d6edc3e
commit
0955d1b86a
2 changed files with 23 additions and 43 deletions
42
internal/cache/copy.go
vendored
42
internal/cache/copy.go
vendored
|
|
@ -1,42 +0,0 @@
|
|||
// GoToSocial
|
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cache
|
||||
|
||||
import "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
|
||||
func copyStatus(s1 *gtsmodel.Status) *gtsmodel.Status {
|
||||
s2 := new(gtsmodel.Status)
|
||||
*s2 = *s1
|
||||
|
||||
// Don't include ptr fields that
|
||||
// will be populated separately.
|
||||
// See internal/db/bundb/status.go.
|
||||
s2.Account = nil
|
||||
s2.InReplyTo = nil
|
||||
s2.InReplyToAccount = nil
|
||||
s2.BoostOf = nil
|
||||
s2.BoostOfAccount = nil
|
||||
s2.Poll = nil
|
||||
s2.Attachments = nil
|
||||
s2.Tags = nil
|
||||
s2.Mentions = nil
|
||||
s2.Emojis = nil
|
||||
s2.CreatedWithApplication = nil
|
||||
|
||||
return s2
|
||||
}
|
||||
24
internal/cache/db.go
vendored
24
internal/cache/db.go
vendored
|
|
@ -1312,6 +1312,28 @@ func (c *Caches) initStatus() {
|
|||
|
||||
log.Infof(nil, "cache size = %d", cap)
|
||||
|
||||
copyF := func(s1 *gtsmodel.Status) *gtsmodel.Status {
|
||||
s2 := new(gtsmodel.Status)
|
||||
*s2 = *s1
|
||||
|
||||
// Don't include ptr fields that
|
||||
// will be populated separately.
|
||||
// See internal/db/bundb/status.go.
|
||||
s2.Account = nil
|
||||
s2.InReplyTo = nil
|
||||
s2.InReplyToAccount = nil
|
||||
s2.BoostOf = nil
|
||||
s2.BoostOfAccount = nil
|
||||
s2.Poll = nil
|
||||
s2.Attachments = nil
|
||||
s2.Tags = nil
|
||||
s2.Mentions = nil
|
||||
s2.Emojis = nil
|
||||
s2.CreatedWithApplication = nil
|
||||
|
||||
return s2
|
||||
}
|
||||
|
||||
c.DB.Status.Init(structr.CacheConfig[*gtsmodel.Status]{
|
||||
Indices: []structr.IndexConfig{
|
||||
{Fields: "ID"},
|
||||
|
|
@ -1323,7 +1345,7 @@ func (c *Caches) initStatus() {
|
|||
},
|
||||
MaxSize: cap,
|
||||
IgnoreErr: ignoreErrors,
|
||||
Copy: copyStatus,
|
||||
Copy: copyF,
|
||||
Invalidate: c.OnInvalidateStatus,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue