Skip to content

Commit f47c3f5

Browse files
authored
fix: plugin chain cache cannot retrieve chain (#451)
1 parent 46cd71e commit f47c3f5

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

common/lib/plugin_manager.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ class PluginChain<T> {
5454
return this;
5555
}
5656

57-
execute(pluginFunc: PluginFunc<T>): Promise<T> {
57+
execute(pluginFunc: PluginFunc<T>, targetFunc: () => Promise<T>): Promise<T> {
5858
if (this.chain === undefined) {
5959
throw new AwsWrapperError(Messages.get("PluginManager.pipelineNone"));
6060
}
61-
return this.chain(pluginFunc, this.targetFunc);
61+
return this.chain(pluginFunc, targetFunc);
6262
}
6363
}
6464

6565
export class PluginManager {
66-
private static readonly PLUGIN_CHAIN_CACHE = new Map<[string, HostInfo], PluginChain<any>>();
66+
private static readonly PLUGIN_CHAIN_CACHE = new Map<string, PluginChain<any>>();
6767
private static readonly STRATEGY_PLUGIN_CHAIN_CACHE = new Map<ConnectionPlugin[], Set<ConnectionPlugin>>();
6868
private static readonly ALL_METHODS: string = "*";
6969
private static readonly CONNECT_METHOD = "connect";
@@ -189,12 +189,12 @@ export class PluginManager {
189189
pluginFunc: PluginFunc<T>,
190190
methodFunc: () => Promise<T>
191191
): Promise<T> {
192-
let chain = PluginManager.PLUGIN_CHAIN_CACHE.get([methodName, hostInfo]);
192+
let chain = PluginManager.PLUGIN_CHAIN_CACHE.get(methodName);
193193
if (!chain) {
194194
chain = this.makeExecutePipeline(hostInfo, props, methodName, methodFunc);
195-
PluginManager.PLUGIN_CHAIN_CACHE.set([methodName, hostInfo], chain);
195+
PluginManager.PLUGIN_CHAIN_CACHE.set(methodName, chain);
196196
}
197-
return chain.execute(pluginFunc);
197+
return chain.execute(pluginFunc, methodFunc);
198198
}
199199

200200
makeExecutePipeline<T>(hostInfo: HostInfo, props: Map<string, any>, name: string, methodFunc: () => Promise<T>): PluginChain<T> {

0 commit comments

Comments
 (0)