mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
feat(BRIDGE-363): Observability metrics for IMAP connections; minor unleash service refactor;
This commit is contained in:
@ -110,7 +110,7 @@ func New(
|
||||
syncConfigDir string,
|
||||
isNew bool,
|
||||
notificationStore *notifications.Store,
|
||||
getFlagValFn unleash.GetFlagValueFn,
|
||||
featureFlagValueProvider unleash.FeatureFlagValueProvider,
|
||||
) (*User, error) {
|
||||
user, err := newImpl(
|
||||
ctx,
|
||||
@ -130,7 +130,7 @@ func New(
|
||||
syncConfigDir,
|
||||
isNew,
|
||||
notificationStore,
|
||||
getFlagValFn,
|
||||
featureFlagValueProvider,
|
||||
)
|
||||
if err != nil {
|
||||
// Cleanup any pending resources on error
|
||||
@ -163,7 +163,7 @@ func newImpl(
|
||||
syncConfigDir string,
|
||||
isNew bool,
|
||||
notificationStore *notifications.Store,
|
||||
getFlagValueFn unleash.GetFlagValueFn,
|
||||
featureFlagValueProvider unleash.FeatureFlagValueProvider,
|
||||
) (*User, error) {
|
||||
logrus.WithField("userID", apiUser.ID).Info("Creating new user")
|
||||
|
||||
@ -262,6 +262,8 @@ func newImpl(
|
||||
identityState.Clone(),
|
||||
smtpServerManager,
|
||||
observabilityService,
|
||||
imapServerManager,
|
||||
featureFlagValueProvider,
|
||||
)
|
||||
|
||||
user.imapService = imapservice.NewService(
|
||||
@ -284,7 +286,7 @@ func newImpl(
|
||||
observabilityService,
|
||||
)
|
||||
|
||||
user.notificationService = notifications.NewService(user.id, user.eventService, user, notificationStore, getFlagValueFn, observabilityService)
|
||||
user.notificationService = notifications.NewService(user.id, user.eventService, user, notificationStore, featureFlagValueProvider, observabilityService)
|
||||
|
||||
// When we receive an auth object, we update it in the vault.
|
||||
// This will be used to authorize the user on the next run.
|
||||
|
||||
@ -33,6 +33,7 @@ import (
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/services/observability"
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/services/smtp"
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/telemetry/mocks"
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/unleash"
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/vault"
|
||||
"github.com/ProtonMail/proton-bridge/v3/tests"
|
||||
"github.com/golang/mock/gomock"
|
||||
@ -150,6 +151,7 @@ func withUser(tb testing.TB, ctx context.Context, _ *server.Server, m *proton.Ma
|
||||
nullEventSubscription := events.NewNullSubscription()
|
||||
nullIMAPServerManager := imapservice.NewNullIMAPServerManager()
|
||||
nullSMTPServerManager := smtp.NewNullServerManager()
|
||||
nullUnleashService := unleash.NewNullUnleashService()
|
||||
|
||||
user, err := New(
|
||||
ctx,
|
||||
@ -171,9 +173,7 @@ func withUser(tb testing.TB, ctx context.Context, _ *server.Server, m *proton.Ma
|
||||
notifications.NewStore(func() (string, error) {
|
||||
return "", nil
|
||||
}),
|
||||
func(_ string) bool {
|
||||
return false
|
||||
},
|
||||
nullUnleashService,
|
||||
)
|
||||
require.NoError(tb, err)
|
||||
defer user.Close()
|
||||
|
||||
Reference in New Issue
Block a user