-
-
Notifications
You must be signed in to change notification settings - Fork 521
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
feat: try other logger ports #3534
base: main
Are you sure you want to change the base?
Conversation
Currently I am only checking till port 9009, @erickzhao can you guide me if we should increase the upper limit for this port availability checking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findAvailablePort
should be split into two functions for easier unit testing and logical decoupling.
I think it would be better if you can move the port-related functions to a different location, as I remember similar requirements elsewhere in the forge.
Moreover, in my opinion, the Logger doesn't actually need to include port-related code, it would be better if it were passed from the outside. For example: logger.start(port)
.
It would be great if you could add relevant unit tests. Thank you for your contribution!
Hi @BlackHole1, just made the changes that you suggested in code review and wrote unit tests for Logger.ts. I couldn't directly test the private functions such as portOccupied and findAvailablePort, so I wrote test for Thank you for the code review, I hope this fixes the issue. Glad to Contribute. |
Can you move
|
Note: I am new to writing tests so I might be wrong |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for contribute.
PTAL @dsanders11 @erickzhao
When I updated the current branch, the CI failed, it seems to be related to Code Lint. @DevanceJ, can you try to fix it? |
Hi Kevin, I just saw this. Working on it now! |
Looking at the time the tests take, can you check my pr adding parallelism in circleci/config #3536.😁 |
I am not very familiar with CircleCI, so #3536 may need to be reviewed by @dsanders11 and @georgexu99. |
Hi Erick, |
BlackHole1 left a LGTM comment above
Looking into this error. |
Hi I am getting this error
when I run yarn test locally but the start method does expect a parameter in reality. Any help on this is appreciated. |
Hi sorry for the delay, I believe there was a naming conflict with the start function. |
@erickzhao please review this. Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also update the API comment on this to reflect that we will attempt to start up to port+10 if the port is unavailable.
forge/packages/plugin/webpack/src/Config.ts
Line 154 in f0dd217
* The TCP port for web-multi-logger. Defaults to 9000. |
return new Promise<number>((resolve) => { | ||
this.server = this.app.listen(this.port, () => resolve(this.port)); | ||
}); | ||
async startPort(loggerPort: number): Promise<number> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should clean up this.port
in the constructor if it isn't being used anymore.
Summarize your changes:
Fixes #3204