Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkg/connector/handlelinkedin.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ func (l *LinkedInClient) onBadCredentials(ctx context.Context, err error) {
Error: "linkedin-bad-credentials",
Message: err.Error(),
})
l.Disconnect()
if errors.Is(err, linkedingo.ErrTokenInvalidated) {
l.userLogin.Metadata.(*UserLoginMetadata).Cookies.Clear()
err = l.userLogin.Save(ctx)
if err != nil {
zerolog.Ctx(ctx).Err(err).Msg("failed to clear cookies after token invalidation")
}
}
// Disconnect in the background so we don't deadlock against the realtime loop which calls this
go l.Disconnect()
}

func (l *LinkedInClient) onUnknownError(ctx context.Context, err error) {
Expand All @@ -48,7 +49,8 @@ func (l *LinkedInClient) onUnknownError(ctx context.Context, err error) {
Message: err.Error(),
})
// TODO probably don't do this unconditionally?
l.Disconnect()
// Disconnect in the background so we don't deadlock against the realtime loop which calls this
go l.Disconnect()
}

func (l *LinkedInClient) onDecoratedEvent(ctx context.Context, decoratedEvent *linkedingo.DecoratedEvent) {
Expand Down