fix(book-requests): tell a plugin indexer when its connection changes

Add an optional forget(indexerId) to the plugin contract and forward the
host's existing invalidation to it, so a plugin holding a live session
drops it when the credential, base URL or private-address setting changes.
A plugin that throws or rejects in forget is logged and never fails the save.

Fixes #1325
This commit is contained in:
neon
2026-10-20 16:51:24 +00:00
parent b95a285c1b
commit cc6bac696b
4 changed files with 102 additions and 0 deletions
+7
View File
@@ -252,4 +252,11 @@ export interface IndexerPlugin {
resolveFile?(release: PluginReleaseCandidate, config: PluginIndexerConfig, host: PluginHost, signal: AbortSignal): Promise<PluginReleaseFile>;
/** Sources whose session expires on its own clock, called on a schedule while enabled. */
keepalive?(config: PluginIndexerConfig, host: PluginHost): Promise<void>;
/**
* Drop anything held in memory for this indexer, such as a live session. Called when an operator
* changes its base URL, credential or private-address setting, so the next call starts from the
* stored config. Not awaited, and a failure is logged rather than reported. Never called by hosts
* older than the hook.
*/
forget?(indexerId: number): void | Promise<void>;
}