Skip to content

Commit ec754c8

Browse files
fix: increase default RPC timeout to 120s and make it configurable via GRAPH_RPC_TIMEOUT_MS
1 parent 17bd0cd commit ec754c8

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎src/graph/rpc.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
import { EventEmitter } from 'events'
44

5-
const RPC_TIMEOUT_MS = 30000
5+
/**
6+
* RPC timeout in milliseconds.
7+
* Configure via GRAPH_RPC_TIMEOUT_MS environment variable.
8+
* Default: 120000 (120 seconds)
9+
*/
10+
export const RPC_TIMEOUT_MS = parseInt(process.env.GRAPH_RPC_TIMEOUT_MS ?? '120000', 10)
611

712
/**
813
* Generic RPC client for worker communication

‎src/graph/service.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ interface GraphServiceConfig {
5757
watch?: boolean
5858
debounceMs?: number
5959
maxFiles?: number
60+
rpcTimeoutMs?: number
6061
onStatusChange?: GraphStatusCallback
6162
}
6263

@@ -69,7 +70,7 @@ interface PendingChange {
6970
const DEFAULT_DEBOUNCE_MS = 500
7071

7172
export function createGraphService(config: GraphServiceConfig): GraphService {
72-
const { projectId, dataDir, cwd, logger, watch: watchEnabled, debounceMs, maxFiles, onStatusChange } = config
73+
const { projectId, dataDir, cwd, logger, watch: watchEnabled, debounceMs, maxFiles, rpcTimeoutMs, onStatusChange } = config
7374
const client = new GraphClient()
7475
let dbPath: string | null = null
7576
let initialized = false
@@ -401,6 +402,7 @@ export function createGraphService(config: GraphServiceConfig): GraphService {
401402
GRAPH_DB_PATH: dbPath,
402403
GRAPH_CWD: cwd,
403404
GRAPH_MAX_FILES: maxFiles?.toString() ?? '',
405+
GRAPH_RPC_TIMEOUT_MS: (rpcTimeoutMs ?? 120000).toString(),
404406
},
405407
})
406408

‎src/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export function createForgePlugin(config: PluginConfig): Plugin {
115115
watch: config.graph?.watch ?? true,
116116
debounceMs: config.graph?.debounceMs,
117117
maxFiles: config.graph?.maxFiles,
118+
rpcTimeoutMs: config.graph?.rpcTimeoutMs,
118119
onStatusChange: graphStatusCallback,
119120
})
120121

‎src/types.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ export interface GraphConfig {
106106
maxFiles?: number
107107
watch?: boolean
108108
debounceMs?: number
109+
/** RPC timeout in milliseconds. Default: 120000 (120 seconds) */
110+
rpcTimeoutMs?: number
109111
}
110112

111113
export interface PluginConfig {

0 commit comments

Comments
 (0)