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

[API] increase api listener limit #4374

Merged
merged 5 commits into from
Sep 2, 2024
Merged

Conversation

envestcc
Copy link
Member

@envestcc envestcc commented Aug 24, 2024

Description

Temporarily relax #4373 , increase global listen limits to 5000 from 500

Ultimately, the api eth_subscribe and eth_unsubscribe should only take effect for websockets, and related listeners should be cleaned up after the connection is disconnected. The limitations can also be revised to apply to the number of listeners per connection.

Type of change

Please delete options that are not relevant.

  • Code refactor or improvement

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [] make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

return status.Error(codes.Internal, err.Error())
}
err := <-errChan
err = <-errChan
chainListener.RemoveResponder(id)
Copy link
Member

Choose a reason for hiding this comment

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

why remove here?

Copy link
Member Author

Choose a reason for hiding this comment

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

receiving the errChan means the end of the StreamBlocks

chainListener := svr.coreService.ChainListener()
streamID, err := chainListener.AddResponder(NewWeb3BlockListener(writer.Write))
if err != nil {
return nil, err
}
ctx.AddListener(streamID)
Copy link
Member

Choose a reason for hiding this comment

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

and add here?

Copy link
Member Author

Choose a reason for hiding this comment

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

the removing should after wss disconnected, not here

for _, id := range sc.ListenerIDs() {
wsSvr.coreService.ChainListener().RemoveResponder(id)
}
}
for {
select {
case <-ctx.Done():
Copy link
Member

Choose a reason for hiding this comment

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

here should also call cancel to clean up (remove all responder)?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch

Copy link

sonarcloud bot commented Sep 2, 2024

@envestcc envestcc merged commit 778b8ee into iotexproject:master Sep 2, 2024
3 checks passed
@envestcc envestcc deleted the listenlimit branch September 2, 2024 01:42
envestcc added a commit that referenced this pull request Sep 3, 2024
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