From 87bc2847324372aa1b0c75978128bec250124046 Mon Sep 17 00:00:00 2001 From: Guilherme Salazar Date: Wed, 13 Mar 2024 11:15:09 -0300 Subject: [PATCH] fix(pluginserver): ensure a change to plugin config takes effect (#12718) (cherry picked from commit 97c265176959a463e2e60931f0274ff627ced554) --- changelog/unreleased/kong/fix-external-plugin-instance.yml | 5 +++++ kong/runloop/plugin_servers/init.lua | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 changelog/unreleased/kong/fix-external-plugin-instance.yml diff --git a/changelog/unreleased/kong/fix-external-plugin-instance.yml b/changelog/unreleased/kong/fix-external-plugin-instance.yml new file mode 100644 index 000000000000..b92665f2d9be --- /dev/null +++ b/changelog/unreleased/kong/fix-external-plugin-instance.yml @@ -0,0 +1,5 @@ +message: | + Fix an issue where an external plugin (Go, Javascript, or Python) would fail to + apply a change to the plugin config via the Admin API. +type: bugfix +scope: Configuration diff --git a/kong/runloop/plugin_servers/init.lua b/kong/runloop/plugin_servers/init.lua index 6c3937efc8ec..316bb11012cb 100644 --- a/kong/runloop/plugin_servers/init.lua +++ b/kong/runloop/plugin_servers/init.lua @@ -213,6 +213,7 @@ function get_instance_id(plugin_name, conf) if instance_info and instance_info.id + and instance_info.seq == conf.__seq__ and instance_info.conf and instance_info.conf.__plugin_id == key then -- exact match, return it @@ -224,6 +225,7 @@ function get_instance_id(plugin_name, conf) -- we're the first, put something to claim instance_info = { conf = conf, + seq = conf.__seq__, } running_instances[key] = instance_info else @@ -246,6 +248,7 @@ function get_instance_id(plugin_name, conf) instance_info.id = new_instance_info.id instance_info.plugin_name = plugin_name instance_info.conf = new_instance_info.conf + instance_info.seq = new_instance_info.seq instance_info.Config = new_instance_info.Config instance_info.rpc = new_instance_info.rpc