Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions graphile/graphile-cache/src/graphile-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ const manualEvictionKeys = new Set<string>();
* Dispose a PostGraphile v5 cache entry
*
* Properly releases resources by:
* 1. Releasing the grafserv instance
* 2. Closing the HTTP server if listening
* 3. Releasing the PostGraphile instance
* 1. Closing the HTTP server if listening
* 2. Releasing the PostGraphile instance (which internally releases grafserv)
*
* Uses disposedKeys set to prevent double-disposal when closeAllCaches()
* explicitly disposes entries and then clear() triggers the dispose callback.
Expand All @@ -114,17 +113,13 @@ const disposeEntry = async (entry: GraphileCacheEntry, key: string): Promise<voi

log.debug(`Disposing PostGraphile[${key}]`);
try {
// Release grafserv first
if (entry.serv) {
await entry.serv.release();
}
// Close HTTP server if it's listening
if (entry.httpServer?.listening) {
await new Promise<void>((resolve) => {
entry.httpServer.close(() => resolve());
});
}
// Release PostGraphile instance
// Release PostGraphile instance (this also releases grafserv internally)
if (entry.pgl) {
await entry.pgl.release();
}
Expand Down