Skip to content

Conversation

@dplewis
Copy link
Member

@dplewis dplewis commented Mar 11, 2025

Pull Request

Issue

While working on parse-community/Parse-SDK-JS#2490 I noticed that parseServer.handleShutdown() doesn't close all connections. This results in server.close(callback) callback from running causing timeouts in the test suite.

Approach

I moved all closing logic to handleShutdown. I also added it to the test suite on reconfigureServer. This has a few benefits.

  • No more flaky tests with timeout caused by helper.js
Error: Timeout - Async function did not complete within 20000ms (set by jasmine.DEFAULT_TIMEOUT_INTERVAL)
  • Add known flaky tests to retry logic
  • Fix a few flaky tests
  • Gracefully shutdown redis pubsub
  • Gracefully shutdown live query server when created on a different port from the server
  • reconfigureServer is now a new server instance with a new databaseAdapter, fileAdapter, etc. Before you could use the databaseAdapter from a previous reconfigureServer. Now you get a Client is closed error or something similar. This allows for invariant between test
  • Fixed tests trying to access a shutdown database
  • Reduces number of reconfigureServer calls

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)

@parse-github-assistant
Copy link

parse-github-assistant bot commented Mar 11, 2025

🚀 Thanks for opening this pull request!

@codecov
Copy link

codecov bot commented Mar 11, 2025

Codecov Report

Attention: Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.15%. Comparing base (b2beaa8) to head (d35273a).
Report is 12 commits behind head on alpha.

Files with missing lines Patch % Lines
src/LiveQuery/ParseLiveQueryServer.js 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            alpha    #9634      +/-   ##
==========================================
+ Coverage   93.12%   93.15%   +0.03%     
==========================================
  Files         187      187              
  Lines       15037    15066      +29     
==========================================
+ Hits        14003    14035      +32     
+ Misses       1034     1031       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dplewis dplewis force-pushed the graceful-shutdown branch from 89de779 to 1877ced Compare March 11, 2025 16:36
@dplewis dplewis requested a review from a team March 11, 2025 17:03
@dplewis
Copy link
Member Author

dplewis commented Mar 11, 2025

@parse-community/server-review This is ready for review.

@dplewis
Copy link
Member Author

dplewis commented Mar 20, 2025

@mtrezza is this good to merge?

@mtrezza
Copy link
Member

mtrezza commented Mar 20, 2025

I hade a review comment, but it was pending.

@mtrezza mtrezza changed the title fix: Parse server doesn't shutdown gracefully fix: Parse Server doesn't shutdown gracefully Mar 27, 2025
@mtrezza mtrezza merged commit aed918d into parse-community:alpha Mar 27, 2025
24 checks passed
parseplatformorg pushed a commit that referenced this pull request Mar 27, 2025
# [8.1.0-alpha.3](8.1.0-alpha.2...8.1.0-alpha.3) (2025-03-27)

### Bug Fixes

* Parse Server doesn't shutdown gracefully ([#9634](#9634)) ([aed918d](aed918d))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 8.1.0-alpha.3

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Mar 27, 2025
@dplewis dplewis deleted the graceful-shutdown branch April 1, 2025 14:06
parseplatformorg pushed a commit that referenced this pull request Apr 4, 2025
# [8.1.0](8.0.2...8.1.0) (2025-04-04)

### Bug Fixes

* Parse Server doesn't shutdown gracefully ([#9634](#9634)) ([aed918d](aed918d))

### Features

* Add Cloud Code triggers `Parse.Cloud.beforeFind(Parse.File)`and `Parse.Cloud.afterFind(Parse.File)` ([#8700](#8700)) ([b2beaa8](b2beaa8))
* Add default ACL ([#8701](#8701)) ([12b5d78](12b5d78))
* Upgrade Parse JS SDK from 6.0.0 to 6.1.0 ([#9686](#9686)) ([f49c371](f49c371))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 8.1.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released Released as stable version state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants