Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not propagate exception once context has been closed in PushRegistrationHandler #1282

Merged
merged 1 commit into from
Aug 10, 2022

Conversation

AlexanderEllis
Copy link
Contributor

Because PushRegistrationHandler handles the exception and closes the context, it does not need to pass the exception on past itself.

Also removed the final so it can be overridden.

@artgon
Copy link
Contributor

artgon commented Aug 9, 2022

LGTM

@@ -95,10 +95,9 @@ public final void channelInactive(ChannelHandlerContext ctx) throws Exception {
}

@Override
public final void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
logger.error("Exception caught, closing push channel for " + authEvent, cause);
ctx.close();
Copy link
Contributor

@gavinbunney gavinbunney Aug 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we shift to closing on flush (i.e. closeOnFlush) rather than explicit close here?

if (ctx.channel().isActive()) {
    ctx.channel().writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synced offline — we can keep this change small and keep the close() behavior while still removing the final in case we (or anyone else) wants to override with the fancier closeOnFlush 👍

@AlexanderEllis AlexanderEllis merged commit 9dc95fa into master Aug 10, 2022
@AlexanderEllis AlexanderEllis deleted the alex/exceptionCaught branch August 10, 2022 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants