11import { readFile } from 'node:fs/promises' ;
22import { join } from 'node:path' ;
33import { getOptions } from './options.context' ;
4- import { RESOURCE_MEMO_OPTIONS } from './options.defaults' ;
4+ import { DEFAULT_OPTIONS } from './options.defaults' ;
55import { memo } from './server.caching' ;
66
77/**
@@ -14,7 +14,7 @@ const readLocalFileFunction = async (filePath: string) => await readFile(filePat
1414/**
1515 * Memoized version of readLocalFileFunction. Use default memo options.
1616 */
17- readLocalFileFunction . memo = memo ( readLocalFileFunction , RESOURCE_MEMO_OPTIONS . readFile ) ;
17+ readLocalFileFunction . memo = memo ( readLocalFileFunction , DEFAULT_OPTIONS . resourceMemoOptions . readFile ) ;
1818
1919/**
2020 * Fetch content from a URL with timeout and error handling
@@ -26,6 +26,9 @@ const fetchUrlFunction = async (url: string) => {
2626 const timeoutMs = Number ( process . env . DOC_MCP_FETCH_TIMEOUT_MS || 15_000 ) ;
2727 const timeout = setTimeout ( ( ) => controller . abort ( ) , timeoutMs ) ;
2828
29+ // Allow the process to exit
30+ timeout . unref ( ) ;
31+
2932 try {
3033 const response = await fetch ( url , {
3134 signal : controller . signal ,
@@ -45,7 +48,7 @@ const fetchUrlFunction = async (url: string) => {
4548/**
4649 * Memoized version of fetchUrlFunction. Use default memo options.
4750 */
48- fetchUrlFunction . memo = memo ( fetchUrlFunction , RESOURCE_MEMO_OPTIONS . fetchUrl ) ;
51+ fetchUrlFunction . memo = memo ( fetchUrlFunction , DEFAULT_OPTIONS . resourceMemoOptions . fetchUrl ) ;
4952
5053/**
5154 * Resolve a local path depending on docs host flag
0 commit comments