feat(GODT-2500): Reorganise async methods.

This commit is contained in:
Jakub
2023-03-30 17:50:40 +02:00
parent ec92c918cd
commit de5fd07a22
42 changed files with 136 additions and 511 deletions

View File

@ -29,8 +29,8 @@ import (
"runtime"
"time"
"github.com/ProtonMail/gluon/async"
"github.com/ProtonMail/gluon/imap"
"github.com/ProtonMail/gluon/queue"
"github.com/ProtonMail/proton-bridge/v3/internal/bridge"
"github.com/ProtonMail/proton-bridge/v3/internal/constants"
"github.com/ProtonMail/proton-bridge/v3/internal/cookies"
@ -108,7 +108,7 @@ func (t *testCtx) initBridge() (<-chan events.Event, error) {
}
// Create the vault.
vault, corrupt, err := vault.New(vaultDir, gluonCacheDir, t.storeKey, queue.NoopPanicHandler{})
vault, corrupt, err := vault.New(vaultDir, gluonCacheDir, t.storeKey, async.NoopPanicHandler{})
if err != nil {
return nil, fmt.Errorf("could not create vault: %w", err)
} else if corrupt {
@ -200,7 +200,7 @@ func (t *testCtx) initFrontendService(eventCh <-chan events.Event) error {
t.mocks.Autostarter.EXPECT().IsEnabled().AnyTimes()
service, err := frontend.NewService(
new(mockCrashHandler),
&async.NoopPanicHandler{},
new(mockRestarter),
t.locator,
t.bridge,
@ -301,7 +301,7 @@ func (t *testCtx) initFrontendClient() error {
return fmt.Errorf("could not start event stream: %w", err)
}
eventCh := queue.NewQueuedChannel[*frontend.StreamEvent](0, 0, queue.NoopPanicHandler{})
eventCh := async.NewQueuedChannel[*frontend.StreamEvent](0, 0, async.NoopPanicHandler{})
go func() {
defer eventCh.CloseAndDiscardQueued()
@ -343,10 +343,6 @@ func (t *testCtx) closeFrontendClient() error {
return nil
}
type mockCrashHandler struct{}
func (m *mockCrashHandler) HandlePanic() {}
type mockRestarter struct{}
func (m *mockRestarter) Set(restart, crash bool) {}