mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-07 17:04:56 +01:00
[bugfix] Fix incorrect per-loop variable capture (#2092)
These should be per iteration, not per loop. This was caught by running a build with the loopvar experiment: go build -gcflags=-d=loopvar=2.
This commit is contained in:
parent
31a215849e
commit
dbf487effb
@ -429,6 +429,7 @@ func (l *listDB) PutListEntries(ctx context.Context, entries []*gtsmodel.ListEnt
|
|||||||
// Finally, insert each list entry into the database.
|
// Finally, insert each list entry into the database.
|
||||||
return l.db.RunInTx(ctx, func(tx bun.Tx) error {
|
return l.db.RunInTx(ctx, func(tx bun.Tx) error {
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
|
entry := entry // rescope
|
||||||
if err := l.state.Caches.GTS.ListEntry().Store(entry, func() error {
|
if err := l.state.Caches.GTS.ListEntry().Store(entry, func() error {
|
||||||
_, err := tx.
|
_, err := tx.
|
||||||
NewInsert().
|
NewInsert().
|
||||||
|
@ -119,6 +119,7 @@ func (m *manager) Start() error {
|
|||||||
// hasn't been accessed in the last hour.
|
// hasn't been accessed in the last hour.
|
||||||
go func() {
|
go func() {
|
||||||
for now := range time.NewTicker(1 * time.Hour).C {
|
for now := range time.NewTicker(1 * time.Hour).C {
|
||||||
|
now := now // rescope
|
||||||
// Define the range function inside here,
|
// Define the range function inside here,
|
||||||
// so that we can use the 'now' returned
|
// so that we can use the 'now' returned
|
||||||
// by the ticker, instead of having to call
|
// by the ticker, instead of having to call
|
||||||
|
Loading…
Reference in New Issue
Block a user