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

Apply idle time check to event handler channels #1293

Merged
merged 10 commits into from
Aug 9, 2024

Conversation

platfowner
Copy link
Member

Change summary:

  • Apply idle time check to event handler channels (limit: 10 minutes)
  • Apply life time check to event handler channels (limit: 1 hour)
  • Terminate websocket when there are errors in making connections
  • Add getEventHandlerStatus() for monitoring

Related issues:

}

handleConnection(webSocket) {
const LOG_HEADER = 'handleConnection';
try {
if (this.getNumEventChannels() >= NodeConfigs.MAX_NUM_EVENT_CHANNELS) {
webSocket.terminate();
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@jiyoung-an jiyoung-an left a comment

Choose a reason for hiding this comment

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

LGTM with some comments!
Thanks!

const idleTimeMs = channel.getIdleTimeMs();
if (idleTimeMs > NodeConfigs.EVENT_HANDLER_CHANNEL_IDLE_TIME_LIMIT_SECS * 1000) {
logger.info(`[${LOG_HEADER}] Closing long-idle channel: ${JSON.stringify(channel.toObject())}`);
channel.webSocket.terminate();
Copy link
Member

Choose a reason for hiding this comment

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

It seems that the closeChannel method also calls webSocket.terminate().

Copy link
Member Author

Choose a reason for hiding this comment

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

right. just removed. thanks!

const lifeTimeMs = channel.getLifeTimeMs();
if (lifeTimeMs > NodeConfigs.EVENT_HANDLER_CHANNEL_LIFE_TIME_LIMIT_SECS * 1000) {
logger.info(`[${LOG_HEADER}] Closing long-life channel: ${JSON.stringify(channel.toObject())}`);
channel.webSocket.terminate();
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Member Author

Choose a reason for hiding this comment

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

ditto~

Copy link
Member

Choose a reason for hiding this comment

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

👍

@platfowner
Copy link
Member Author

Thanks for the fast review! @jiyoung-an Now merging..

@platfowner platfowner merged commit edf0bdc into develop Aug 9, 2024
2 checks passed
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.

2 participants