fix: Parse Server doesn't shutdown gracefully (#9634)

This commit is contained in:
Diamond Lewis
2025-03-27 15:38:51 -05:00
committed by GitHub
parent f55de2b342
commit aed918d310
19 changed files with 308 additions and 240 deletions

View File

@@ -97,14 +97,22 @@ class ParseLiveQueryServer {
if (this.subscriber.isOpen) {
await Promise.all([
...[...this.clients.values()].map(client => client.parseWebSocket.ws.close()),
this.parseWebSocketServer.close(),
...Array.from(this.subscriber.subscriptions.keys()).map(key =>
this.parseWebSocketServer.close?.(),
...Array.from(this.subscriber.subscriptions?.keys() || []).map(key =>
this.subscriber.unsubscribe(key)
),
this.subscriber.close?.(),
]);
}
this.subscriber.isOpen = false;
if (typeof this.subscriber.quit === 'function') {
try {
await this.subscriber.quit();
} catch (err) {
logger.error('PubSubAdapter error on shutdown', { error: err });
}
} else {
this.subscriber.isOpen = false;
}
}
_createSubscribers() {