-
-
Notifications
You must be signed in to change notification settings - Fork 596
test: Prevent test timeout error by properly closing server #2490
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
Conversation
Thanks for opening this pull request!
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## alpha #2490 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 64 64
Lines 6268 6268
Branches 1468 1468
=========================================
Hits 6268 6268 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@mtrezza The issue still occurred. https://github.com/parse-community/Parse-SDK-JS/actions/runs/13749596429/job/38448859505 This tells me that this issue is with Destroy connections was removed in #2185. This didn't work because you have to destroy the connections after you call https://nodejs.org/api/net.html#event-close
If this fails again the offending line is in |
@mtrezza Until |
@mtrezza This is ready for review |
Are you referring to parse-community/parse-server#9634? Since it has been merged, are there any changes needed here, e.g. can the shutdown logic be removed here - because you wrote "Until parseServer.handleShutdown is fixed..."? |
You can merge this now then we can change it whenever parse-community/parse-server#9634 gets merged (I hope it works) and the server update gets released. This should work fine as is. |
🎉 This change has been released in version 6.1.0-alpha.3 |
🎉 This change has been released in version 6.1.0 |
Pull Request
Issue
https://github.com/parse-community/Parse-SDK-JS/actions/runs/13735695802/job/38419094737?pr=2486
parseServer.handleShutdown
callsliveQueryServer.server.close()
. When initializing the server withstartLiveQueryServer
optionliveQueryServer.server
andparseServer.server
are the same so we are calling server.close() twice. This maybe the cause of the issue. As we can see the tests still pass without getting an EADDRINUSE error because now we are calling close once.See: #2487
Approach
afterAll
since the tests end at this point we don't care about open connections as the server will shutdown anyway.If the issue persists then we can try to close all the connections.
server.close
prevents new connections but keeps existing ones alive until they are closed. There is now a server.closeAllConnections() method introduced in Node v18.2.0. If all else fails we can look intoparseServer.handleShutdown()
internals.