mcp: debounce server change notifications (#717)
Debounce and batch notifications for changes in server feature sets (adding or removing tools, prompts, resources, or resource templates). This PR handles server-side change notifications only. We could do the same for client-side notifications (e.g. roots changed), but at the moment we don't need to. Fixes #649.
This commit is contained in:
parent
a5e369ed12
commit
1a964ae23d
1 changed files with 60 additions and 28 deletions
|
|
@ -394,6 +394,8 @@ func notifySessions[S Session, P Params](sessions []S, method string, params P,
|
|||
if sessions == nil {
|
||||
return
|
||||
}
|
||||
// Notify with the background context, so the messages are sent on the
|
||||
// standalone stream.
|
||||
// TODO: make this timeout configurable, or call handleNotify asynchronously.
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
|
|
|
|||
Loading…
Reference in a new issue