feat: Asynchronous initialization of Parse Server (#8232)

BREAKING CHANGE: This release introduces the asynchronous initialization of Parse Server to prevent mounting Parse Server before being ready to receive request; it changes how Parse Server is imported, initialized and started; it also removes the callback `serverStartComplete`; see the [Parse Server 6 migration guide](https://github.com/parse-community/parse-server/blob/alpha/6.0.0.md) for more details (#8232)
This commit is contained in:
Daniel
2022-12-22 01:30:13 +11:00
committed by GitHub
parent db9941c5a6
commit 99fcf45e55
21 changed files with 494 additions and 310 deletions

View File

@@ -115,8 +115,8 @@ describe('ParseLiveQueryServer', function () {
});
describe_only_db('mongo')('initialization', () => {
it('can be initialized through ParseServer without liveQueryServerOptions', async function (done) {
const parseServer = await ParseServer.start({
it('can be initialized through ParseServer without liveQueryServerOptions', async () => {
const parseServer = await ParseServer.startApp({
appId: 'hello',
masterKey: 'world',
port: 22345,
@@ -126,19 +126,14 @@ describe('ParseLiveQueryServer', function () {
classNames: ['Yolo'],
},
startLiveQueryServer: true,
serverStartComplete: () => {
expect(parseServer.liveQueryServer).not.toBeUndefined();
expect(parseServer.liveQueryServer.server).toBe(parseServer.server);
parseServer.server.close(async () => {
await reconfigureServer();
done();
});
},
});
expect(parseServer.liveQueryServer).not.toBeUndefined();
expect(parseServer.liveQueryServer.server).toBe(parseServer.server);
await new Promise(resolve => parseServer.server.close(resolve));
});
it('can be initialized through ParseServer with liveQueryServerOptions', async function (done) {
const parseServer = await ParseServer.start({
it('can be initialized through ParseServer with liveQueryServerOptions', async () => {
const parseServer = await ParseServer.startApp({
appId: 'hello',
masterKey: 'world',
port: 22346,
@@ -150,17 +145,10 @@ describe('ParseLiveQueryServer', function () {
liveQueryServerOptions: {
port: 22347,
},
serverStartComplete: () => {
expect(parseServer.liveQueryServer).not.toBeUndefined();
expect(parseServer.liveQueryServer.server).not.toBe(parseServer.server);
parseServer.liveQueryServer.server.close(
parseServer.server.close.bind(parseServer.server, async () => {
await reconfigureServer();
done();
})
);
},
});
expect(parseServer.liveQueryServer).not.toBeUndefined();
expect(parseServer.liveQueryServer.server).not.toBe(parseServer.server);
await new Promise(resolve => parseServer.server.close(resolve));
});
});