mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
fix(GODT-3116): Panic on closed channel
If sync finishes during shutdown, check if there is a context error in the deferred go routine before rewinding the event.
This commit is contained in:
@ -395,6 +395,11 @@ func (s *Service) run(ctx context.Context) { //nolint gocyclo
|
|||||||
// event service is unable to reply to the request until the events have been processed.
|
// event service is unable to reply to the request until the events have been processed.
|
||||||
s.log.Info("Sync complete, starting API event stream")
|
s.log.Info("Sync complete, starting API event stream")
|
||||||
go func() {
|
go func() {
|
||||||
|
// If context cancelled do not do anything
|
||||||
|
if ctx.Err() != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := s.eventProvider.RewindEventID(ctx, s.lastHandledEventID); err != nil {
|
if err := s.eventProvider.RewindEventID(ctx, s.lastHandledEventID); err != nil {
|
||||||
if errors.Is(err, context.Canceled) {
|
if errors.Is(err, context.Canceled) {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user