fix(GODT-2590): Fix send on closed channel
Ensure periodic user tasks are terminated before the other user services. The panic triggered due to the fact that the telemetry service was shutdown before this periodic task.
This commit is contained in:
parent
e6b312b437
commit
236c958703
|
@ -589,6 +589,8 @@ func (user *User) Logout(ctx context.Context, withAPI bool) error {
|
|||
return fmt.Errorf("failed to remove user from imap server: %w", err)
|
||||
}
|
||||
|
||||
user.tasks.CancelAndWait()
|
||||
|
||||
// Stop Services
|
||||
user.serviceGroup.CancelAndWait()
|
||||
|
||||
|
@ -598,8 +600,6 @@ func (user *User) Logout(ctx context.Context, withAPI bool) error {
|
|||
// Close imap service.
|
||||
user.imapService.Close()
|
||||
|
||||
user.tasks.CancelAndWait()
|
||||
|
||||
if withAPI {
|
||||
user.log.Debug("Logging out from API")
|
||||
|
||||
|
@ -621,6 +621,9 @@ func (user *User) Logout(ctx context.Context, withAPI bool) error {
|
|||
func (user *User) Close() {
|
||||
user.log.Info("Closing user")
|
||||
|
||||
// Stop any ongoing background tasks.
|
||||
user.tasks.CancelAndWait()
|
||||
|
||||
// Stop Services
|
||||
user.serviceGroup.CancelAndWait()
|
||||
|
||||
|
@ -630,9 +633,6 @@ func (user *User) Close() {
|
|||
// Close imap service.
|
||||
user.imapService.Close()
|
||||
|
||||
// Stop any ongoing background tasks.
|
||||
user.tasks.CancelAndWait()
|
||||
|
||||
// Close the user's API client.
|
||||
user.client.Close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue