Other: Bump liteapi version to fix goroutine leaks

This commit is contained in:
James Houlahan
2022-10-21 12:00:35 +02:00
parent 472b96795f
commit 974735d415
5 changed files with 11 additions and 10 deletions

2
go.mod
View File

@ -39,7 +39,7 @@ require (
github.com/sirupsen/logrus v1.9.0 github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.8.0 github.com/stretchr/testify v1.8.0
github.com/urfave/cli/v2 v2.16.3 github.com/urfave/cli/v2 v2.16.3
gitlab.protontech.ch/go/liteapi v1.0.0 gitlab.protontech.ch/go/liteapi v0.35.0
golang.org/x/exp v0.0.0-20220921164117-439092de6870 golang.org/x/exp v0.0.0-20220921164117-439092de6870
golang.org/x/net v0.1.0 golang.org/x/net v0.1.0
golang.org/x/sys v0.1.0 golang.org/x/sys v0.1.0

4
go.sum
View File

@ -399,8 +399,8 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsr
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0= github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0=
github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA=
gitlab.protontech.ch/go/liteapi v1.0.0 h1:MGds9QjSrEUxRRAwqJ4dxXoBosSNM1+NOUmlP6h1eko= gitlab.protontech.ch/go/liteapi v0.35.0 h1:26Yx8+pp14MPxV1DL8gU+cahPigrEATzm3WpoNQs7kU=
gitlab.protontech.ch/go/liteapi v1.0.0/go.mod h1:VCEA83UCi9f3XCP9W/XUIFnJKwokGB46lKUHBNzPWsQ= gitlab.protontech.ch/go/liteapi v0.35.0/go.mod h1:NuLWhVn8c0bR9qUaJER7VbPFu7oEowWWcP5ANgQHwRo=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=

View File

@ -373,9 +373,7 @@ func (user *User) Close() error {
user.waitSync() user.waitSync()
// Close the user's API client. // Close the user's API client.
if err := user.client.Close(); err != nil { user.client.Close()
logrus.WithError(err).Error("Failed to close API client")
}
// Close the user's update channels. // Close the user's update channels.
user.updateCh.Values(func(updateCh []*queue.QueuedChannel[imap.Update]) { user.updateCh.Values(func(updateCh []*queue.QueuedChannel[imap.Update]) {

View File

@ -126,7 +126,7 @@ func withAccount(tb testing.TB, s *server.Server, username, password string, ema
func withUser(tb testing.TB, ctx context.Context, _ *server.Server, m *liteapi.Manager, username, password string, fn func(*User)) { //nolint:unparam,revive func withUser(tb testing.TB, ctx context.Context, _ *server.Server, m *liteapi.Manager, username, password string, fn func(*User)) { //nolint:unparam,revive
client, apiAuth, err := m.NewClientWithLogin(ctx, username, []byte(password)) client, apiAuth, err := m.NewClientWithLogin(ctx, username, []byte(password))
require.NoError(tb, err) require.NoError(tb, err)
defer func() { require.NoError(tb, client.Close()) }() defer client.Close()
apiUser, err := client.GetUser(ctx) apiUser, err := client.GetUser(ctx)
require.NoError(tb, err) require.NoError(tb, err)

View File

@ -19,6 +19,7 @@ package tests
import ( import (
"context" "context"
"fmt"
"runtime" "runtime"
"github.com/bradenaw/juniper/stream" "github.com/bradenaw/juniper/stream"
@ -34,15 +35,17 @@ func (t *testCtx) withClient(ctx context.Context, username string, fn func(conte
return err return err
} }
defer c.Close()
if err := fn(ctx, c); err != nil { if err := fn(ctx, c); err != nil {
return err return fmt.Errorf("failed to execute with client: %w", err)
} }
if err := c.AuthDelete(ctx); err != nil { if err := c.AuthDelete(ctx); err != nil {
return err return fmt.Errorf("failed to delete auth: %w", err)
} }
return c.Close() return nil
} }
func (t *testCtx) createMessages(ctx context.Context, username, addrID string, req []liteapi.ImportReq) error { func (t *testCtx) createMessages(ctx context.Context, username, addrID string, req []liteapi.ImportReq) error {