Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Correct frontend plugin lifecycle edge cases https://github.com/siyuan-note/siyuan/issues/18979

Danielfe79c8030162
diff --git a/app/src/plugin/lifecycle.test.ts b/app/src/plugin/lifecycle.test.ts
index 8cc430586d..14b46967db 100644
--- a/app/src/plugin/lifecycle.test.ts
+++ b/app/src/plugin/lifecycle.test.ts
@@ -289,7 +289,7 @@ describe("plugin lifecycle coordinator", () => {
assert.equal(events.includes("dispose:sample:false"), true);
});
- it("abandons pending onload before applying the teardown timeout", async () => {
+ it("continues teardown when pending onload reaches the removal deadline", async () => {
const never = new Promise<void>(() => undefined);
const {coordinator, events} = createHarness({
onload(plugin) {
@@ -310,12 +310,32 @@ describe("plugin lifecycle coordinator", () => {
assert.equal(events.includes("init:sample"), false);
assert.equal(events.includes("error:sample:onload"), true);
- assert.equal(events.includes("error:sample:onunload"), true);
+ assert.equal(events.includes("error:sample:onunload"), false);
assert.equal(events.includes("dispose:sample:false"), true);
assert.equal(coordinator.getState("sample"), "absent");
});
- it("uses separate loading and teardown timeout budgets", async () => {
+ it("continues teardown when pending kernel initialization reaches the removal deadline", async () => {
+ const never = new Promise<void>(() => undefined);
+ const {coordinator, events} = createHarness({
+ init(plugin) {
+ events.push(`init:${plugin.name}`);
+ return never;
+ },
+ }, 10);
+ coordinator.start();
+ const loading = coordinator.requestLoad("sample", async () => ({name: "sample", revision: 1}));
+ await nextTurn();
+
+ const unloading = coordinator.requestUnload("sample");
+ await Promise.all([loading, unloading]);
+
+ assert.equal(events.includes("error:sample:kernelInit"), true);
+ assert.equal(events.includes("error:sample:onunload"), false);
+ assert.equal(events.includes("dispose:sample:false"), true);
+ });
+
+ it("shares one removal deadline across loading and teardown", async () => {
const clock = new FakeClock();
const never = new Promise<void>(() => undefined);
const {coordinator, events} = createHarness({
@@ -344,16 +364,52 @@ describe("plugin lifecycle coordinator", () => {
clock.advance(1);
await flushMicrotasks();
assert.equal(events.includes("onunload:sample"), true);
- assert.equal(events.includes("dispose:sample:false"), false);
+ assert.equal(events.includes("error:sample:onload"), true);
+ assert.equal(events.includes("error:sample:onunload"), false);
+ assert.equal(events.includes("dispose:sample:false"), true);
+ await Promise.all([loading, unloading]);
- clock.advance(4999);
+ assert.equal(clock.now, 5000);
+ assert.equal(events.includes("dispose:sample:false"), true);
+ });
+
+ it("uses only the remaining removal budget after onload completes", async () => {
+ const clock = new FakeClock();
+ const loaded = deferred<void>();
+ const never = new Promise<void>(() => undefined);
+ const {coordinator, events} = createHarness({
+ onload(plugin) {
+ events.push(`onload:${plugin.name}`);
+ return loaded.promise;
+ },
+ onunload(plugin) {
+ events.push(`onunload:${plugin.name}`);
+ return never;
+ },
+ }, 5000, {
+ now: () => clock.now,
+ setTimeout: clock.setTimeout,
+ clearTimeout: clock.clearTimeout,
+ });
+ coordinator.start();
+ const loading = coordinator.requestLoad("sample", async () => ({name: "sample", revision: 1}));
+ await flushMicrotasks();
+ const unloading = coordinator.requestUnload("sample");
+ await flushMicrotasks();
+
+ clock.advance(3000);
+ loaded.resolve();
+ await loading;
+ await flushMicrotasks();
+ assert.equal(events.includes("onunload:sample"), true);
+ clock.advance(1999);
await flushMicrotasks();
assert.equal(events.includes("dispose:sample:false"), false);
clock.advance(1);
await flushMicrotasks();
await Promise.all([loading, unloading]);
- assert.equal(clock.now, 10000);
+ assert.equal(clock.now, 5000);
assert.equal(events.includes("dispose:sample:false"), true);
});
@@ -398,10 +454,76 @@ describe("plugin lifecycle coordinator", () => {
assert.equal(uninstallCalls, 1);
assert.equal(events.includes("error:sample:onunload"), true);
- assert.equal(events.includes("error:sample:uninstall"), true);
+ assert.equal(events.includes("error:sample:uninstall"), false);
assert.equal(events.includes("dispose:sample:true"), true);
});
+ it("observes an uninstall rejection after the shared deadline without reporting another timeout", async () => {
+ const never = new Promise<void>(() => undefined);
+ const uninstalled = deferred<void>();
+ const errors: Array<{hook: string, message: string}> = [];
+ const {coordinator, events} = createHarness({
+ onunload(plugin) {
+ events.push(`onunload:${plugin.name}`);
+ return never;
+ },
+ uninstall(plugin) {
+ events.push(`uninstall:${plugin.name}`);
+ return uninstalled.promise;
+ },
+ onError(name, hook, error) {
+ events.push(`error:${name}:${hook}`);
+ errors.push({hook, message: error instanceof Error ? error.message : String(error)});
+ },
+ }, 10);
+ coordinator.start();
+ await coordinator.requestLoad("sample", async () => ({name: "sample", revision: 1}));
+
+ await coordinator.requestUninstall("sample");
+
+ assert.deepEqual(events.filter((event) => [
+ "onunload:sample",
+ "uninstall:sample",
+ "markDisposed:sample",
+ "dispose:sample:true",
+ ].includes(event)), [
+ "onunload:sample",
+ "uninstall:sample",
+ "markDisposed:sample",
+ "dispose:sample:true",
+ ]);
+ assert.equal(errors.some((error) => error.hook === "uninstall"), false);
+ uninstalled.reject(new Error("late uninstall failure"));
+ await nextTurn();
+ assert.deepEqual(errors.filter((error) => error.hook === "uninstall").map((error) => error.message), [
+ "late uninstall failure",
+ ]);
+ });
+
+ it("does not treat synchronous hook work as Promise waiting", async () => {
+ const clock = new FakeClock();
+ const never = new Promise<void>(() => undefined);
+ const {coordinator, events} = createHarness({
+ onunload(plugin) {
+ events.push(`onunload:${plugin.name}`);
+ clock.advance(5000);
+ return never;
+ },
+ }, 5000, {
+ now: () => clock.now,
+ setTimeout: clock.setTimeout,
+ clearTimeout: clock.clearTimeout,
+ });
+ coordinator.start();
+ await coordinator.requestLoad("sample", async () => ({name: "sample", revision: 1}));
+
+ await coordinator.requestUnload("sample");
+
+ assert.equal(clock.now, 5000);
+ assert.equal(events.includes("error:sample:onunload"), false);
+ assert.equal(events.includes("dispose:sample:false"), true);
+ });
+
it("shares one teardown deadline between onunload and uninstall", async () => {
const clock = new FakeClock();
const never = new Promise<void>(() => undefined);
@@ -430,12 +552,48 @@ describe("plugin lifecycle coordinator", () => {
clock.advance(1);
await flushMicrotasks();
assert.equal(events.includes("uninstall:sample"), true);
+ assert.equal(events.includes("error:sample:onunload"), true);
+ assert.equal(events.includes("error:sample:uninstall"), false);
+ assert.equal(events.includes("dispose:sample:true"), true);
+ await uninstalling;
+
+ assert.equal(clock.now, 5000);
+ assert.equal(events.includes("dispose:sample:true"), true);
+ });
+
+ it("starts the removal deadline when a ready-instance request is enqueued", async () => {
+ const clock = new FakeClock();
+ const never = new Promise<void>(() => undefined);
+ const {coordinator, events} = createHarness({
+ onunload(plugin) {
+ events.push(`onunload:${plugin.name}`);
+ return never;
+ },
+ }, 5000, {
+ now: () => clock.now,
+ setTimeout: clock.setTimeout,
+ clearTimeout: clock.clearTimeout,
+ });
+ coordinator.start();
+ await coordinator.setLayoutReady();
+ await coordinator.requestLoad("sample", async () => ({name: "sample", revision: 1}));
+ assert.equal(coordinator.getState("sample"), "ready");
+
+ const uninstalling = coordinator.requestUninstall("sample");
+ clock.advance(1000);
+ await flushMicrotasks();
+ assert.equal(events.includes("onunload:sample"), true);
+ clock.advance(3999);
+ await flushMicrotasks();
assert.equal(events.includes("dispose:sample:true"), false);
- clock.advance(0);
+ clock.advance(1);
await flushMicrotasks();
await uninstalling;
assert.equal(clock.now, 5000);
+ assert.equal(events.includes("error:sample:onunload"), true);
+ assert.equal(events.includes("uninstall:sample"), true);
+ assert.equal(events.includes("error:sample:uninstall"), false);
assert.equal(events.includes("dispose:sample:true"), true);
});
@@ -523,7 +681,114 @@ describe("plugin lifecycle coordinator", () => {
assert.equal(coordinator.getInstance("sample")?.revision, 2);
});
- it("drops data changes when a structural task is pending", async () => {
+ it("delivers coalesced data changes after a pending load creates the instance", async () => {
+ const data = deferred<ITestPluginData>();
+ const {coordinator, events} = createHarness({
+ onDataChanged(plugin) {
+ events.push(`data:${plugin.name}:${plugin.revision}`);
+ },
+ });
+ coordinator.start();
+ const loading = coordinator.requestLoad("sample", () => data.promise);
+ await nextTurn();
+
+ const firstChange = coordinator.requestDataChange("sample");
+ const secondChange = coordinator.requestDataChange("sample");
+ data.resolve({name: "sample", revision: 1});
+ await Promise.all([loading, firstChange, secondChange]);
+
+ assert.equal(events.filter(item => item === "data:sample:1").length, 1);
+ const initIndex = events.indexOf("init:sample");
+ assert.ok(initIndex >= 0 && initIndex < events.indexOf("data:sample:1"));
+ });
+
+ it("moves a pending data change behind a later reload", async () => {
+ const {coordinator, events} = createHarness({
+ onDataChanged(plugin) {
+ events.push(`data:${plugin.name}:${plugin.revision}`);
+ },
+ });
+ coordinator.start();
+ await coordinator.requestLoad("sample", async () => ({name: "sample", revision: 1}));
+
+ const dataChange = coordinator.requestDataChange("sample");
+ const reload = coordinator.requestReload("sample", async () => ({name: "sample", revision: 2}));
+ await Promise.all([dataChange, reload]);
+
+ assert.equal(events.includes("data:sample:1"), false);
+ assert.equal(events.filter(item => item === "data:sample:2").length, 1);
+ });
+
+ it("coalesces data changes while the reloaded instance is still in onload", async () => {
+ const loaded = deferred<void>();
+ const {coordinator, events} = createHarness({
+ onload(plugin) {
+ events.push(`onload:${plugin.name}:${plugin.revision}`);
+ if (plugin.revision === 2) {
+ return loaded.promise;
+ }
+ },
+ init(plugin) {
+ events.push(`init:${plugin.name}:${plugin.revision}`);
+ },
+ onDataChanged(plugin) {
+ events.push(`data:${plugin.name}:${plugin.revision}`);
+ },
+ });
+ coordinator.start();
+ await coordinator.requestLoad("sample", async () => ({name: "sample", revision: 1}));
+
+ const reload = coordinator.requestReload("sample", async () => ({name: "sample", revision: 2}));
+ await nextTurn();
+ assert.equal(coordinator.getState("sample"), "loading");
+ const firstChange = coordinator.requestDataChange("sample");
+ const secondChange = coordinator.requestDataChange("sample");
+ loaded.resolve();
+ await Promise.all([reload, firstChange, secondChange]);
+
+ assert.equal(events.filter(item => item === "data:sample:2").length, 1);
+ const initIndex = events.indexOf("init:sample:2");
+ assert.ok(initIndex >= 0 && initIndex < events.indexOf("data:sample:2"));
+ });
+
+ it("delivers data changes after a queued unload and load leave a new instance", async () => {
+ const unloaded = deferred<void>();
+ const {coordinator, events} = createHarness({
+ onDataChanged(plugin) {
+ events.push(`data:${plugin.name}:${plugin.revision}`);
+ },
+ onunload(plugin) {
+ events.push(`onunload:${plugin.name}`);
+ return unloaded.promise;
+ },
+ });
+ coordinator.start();
+ await coordinator.requestLoad("sample", async () => ({name: "sample", revision: 1}));
+
+ const unloading = coordinator.requestUnload("sample");
+ await nextTurn();
+ const loading = coordinator.requestLoad("sample", async () => ({name: "sample", revision: 2}));
+ const dataChange = coordinator.requestDataChange("sample");
+ unloaded.resolve();
+ await Promise.all([unloading, loading, dataChange]);
+
+ assert.equal(events.includes("data:sample:1"), false);
+ assert.equal(events.filter(item => item === "data:sample:2").length, 1);
+ });
+
+ it("completes a pending data change when loading produces no instance", async () => {
+ const {coordinator, events} = createHarness();
+ coordinator.start();
+ const loading = coordinator.requestLoad("sample", async () => undefined);
+ const dataChange = coordinator.requestDataChange("sample");
+
+ await Promise.all([loading, dataChange]);
+
+ assert.equal(events.includes("data:sample"), false);
+ assert.equal(coordinator.getState("sample"), "absent");
+ });
+
+ it("drops data changes when the final structural intent is unload", async () => {
const unloaded = deferred<void>();
const {coordinator, events} = createHarness({
onunload(plugin) {
@@ -542,6 +807,21 @@ describe("plugin lifecycle coordinator", () => {
assert.equal(events.includes("data:sample"), false);
});
+ it("drops a queued data change before uninstall and resolves every waiter", async () => {
+ const {coordinator, events} = createHarness();
+ coordinator.start();
+ await coordinator.requestLoad("sample", async () => ({name: "sample", revision: 1}));
+
+ const firstChange = coordinator.requestDataChange("sample");
+ const secondChange = coordinator.requestDataChange("sample");
+ const uninstalling = coordinator.requestUninstall("sample");
+ await Promise.all([firstChange, secondChange, uninstalling]);
+
+ assert.equal(events.includes("data:sample"), false);
+ assert.equal(events.includes("uninstall:sample"), true);
+ assert.equal(events.includes("dispose:sample:true"), true);
+ });
+
it("runs different plugin queues in parallel", async () => {
const loads = new Map(["first", "second"].map(name => [name, deferred<void>()]));
const {coordinator} = createHarness({
diff --git a/app/src/plugin/lifecycle.ts b/app/src/plugin/lifecycle.ts
index 28286f9de2..9591c66c21 100644
--- a/app/src/plugin/lifecycle.ts
+++ b/app/src/plugin/lifecycle.ts
@@ -171,8 +171,9 @@ export class PluginLifecycleCoordinator<TData, TPlugin> {
public requestDataChange(name: string) {
const record = this.getRecord(name);
- if (!record.instance || record.currentTask && this.isStructural(record.currentTask.kind) ||
- record.tasks.some((task) => this.isStructural(task.kind))) {
+ const finalStructuralKind = this.getFinalStructuralKind(record);
+ if (finalStructuralKind === "unload" || finalStructuralKind === "uninstall" ||
+ !record.instance && finalStructuralKind !== "load" && finalStructuralKind !== "reload") {
return Promise.resolve();
}
const existing = record.tasks.find((task) => task.kind === "dataChange");
@@ -233,7 +234,7 @@ export class PluginLifecycleCoordinator<TData, TPlugin> {
dataProvider?: () => Promise<TData | undefined>, sequence = ++this.sequence) {
record.lastStructuralSequence = sequence;
record.latestStructuralKind = kind;
- this.dropPendingDataChanges(record);
+ const pendingDataChange = this.takePendingDataChange(record);
const task: IPluginLifecycleTask<TData> = {
kind,
sequence,
@@ -243,7 +244,15 @@ export class PluginLifecycleCoordinator<TData, TPlugin> {
if (kind === "reload" || kind === "unload" || kind === "uninstall") {
this.signalRemoval(record, this.now() + this.teardownTimeout);
}
- return this.enqueue(record, task);
+ const promise = this.enqueue(record, task);
+ if (pendingDataChange) {
+ if (kind === "load" || kind === "reload") {
+ record.tasks.push(pendingDataChange);
+ } else {
+ pendingDataChange.waiters.forEach((resolve) => resolve());
+ }
+ }
+ return promise;
}
private enqueue(record: IPluginLifecycleRecord<TData, TPlugin>, task: IPluginLifecycleTask<TData>) {
@@ -400,7 +409,7 @@ export class PluginLifecycleCoordinator<TData, TPlugin> {
}
private runDataChange(record: IPluginLifecycleRecord<TData, TPlugin>) {
- if (!record.instance || record.tasks.some((task) => this.isStructural(task.kind))) {
+ if (!record.instance) {
return;
}
try {
@@ -421,17 +430,17 @@ export class PluginLifecycleCoordinator<TData, TPlugin> {
record.state = "absent";
return;
}
- const deadline = this.now() + this.teardownTimeout;
+ // 加载阶段收到的拆除请求与后续拆除钩子共用首次请求建立的超时预算。
+ // Promise 无法取消;预算耗尽后仍尽力调用后续钩子,但不再为它们追加等待时间。
+ const deadline = record.removalDeadline ?? this.now() + this.teardownTimeout;
record.state = "unloading";
- const unloadPromise = this.observe(record.name, "onunload", () => this.adapter.onunload(plugin));
- if (!await this.waitUntilDeadline(unloadPromise, deadline)) {
+ if (!await this.runTeardownHook(record.name, "onunload", () => this.adapter.onunload(plugin), deadline)) {
this.reportTimeout(record.name, "onunload");
}
uninstall = uninstall || this.hasPendingUninstall(record);
if (uninstall) {
record.state = "uninstalling";
- const uninstallPromise = this.observe(record.name, "uninstall", () => this.adapter.uninstall(plugin));
- if (!await this.waitUntilDeadline(uninstallPromise, deadline)) {
+ if (!await this.runTeardownHook(record.name, "uninstall", () => this.adapter.uninstall(plugin), deadline)) {
this.reportTimeout(record.name, "uninstall");
}
this.markPendingUninstallsHandled(record, task);
@@ -447,6 +456,26 @@ export class PluginLifecycleCoordinator<TData, TPlugin> {
this.resetInterrupt(record);
}
+ private runTeardownHook(name: string, hook: "onunload" | "uninstall",
+ callback: () => Promise<void> | void, deadline: number) {
+ try {
+ const result = callback();
+ if (!result || typeof result.then !== "function") {
+ return Promise.resolve(true);
+ }
+ const promise = Promise.resolve(result).catch((error) => {
+ this.adapter.onError(name, hook, error);
+ });
+ if (deadline <= this.now()) {
+ return Promise.resolve(true);
+ }
+ return this.waitUntilDeadline(promise, deadline);
+ } catch (error) {
+ this.adapter.onError(name, hook, error);
+ return Promise.resolve(true);
+ }
+ }
+
private runInterruptibleHook(record: IPluginLifecycleRecord<TData, TPlugin>, hook: TPluginLifecycleHook,
callback: () => Promise<void> | void) {
const hookPromise = this.observe(record.name, hook, callback).then(() => true);
@@ -481,9 +510,12 @@ export class PluginLifecycleCoordinator<TData, TPlugin> {
}
private waitUntilDeadline(promise: Promise<unknown>, deadline: number) {
+ const remaining = deadline - this.now();
+ if (remaining <= 0) {
+ return Promise.resolve(false);
+ }
return new Promise<boolean>((resolve) => {
let settled = false;
- const remaining = Math.max(0, deadline - this.now());
const timer = this.setTimeout(() => {
if (settled) {
return;
@@ -515,7 +547,8 @@ export class PluginLifecycleCoordinator<TData, TPlugin> {
}
private reportTimeout(name: string, hook: TPluginLifecycleHook) {
- this.adapter.onError(name, hook, new Error(`plugin lifecycle hook timed out after ${this.teardownTimeout}ms`));
+ this.adapter.onError(name, hook,
+ new Error(`plugin lifecycle removal deadline reached while waiting for ${hook}`));
}
private markDisposed(name: string, plugin: TPlugin) {
@@ -527,10 +560,10 @@ export class PluginLifecycleCoordinator<TData, TPlugin> {
}
private signalRemoval(record: IPluginLifecycleRecord<TData, TPlugin>, deadline: number) {
+ record.removalDeadline = Math.min(record.removalDeadline ?? Number.POSITIVE_INFINITY, deadline);
if (record.state !== "loading" && record.state !== "layouting") {
return;
}
- record.removalDeadline = Math.min(record.removalDeadline ?? Number.POSITIVE_INFINITY, deadline);
if (!record.interrupt.resolved) {
record.interrupt.resolved = true;
record.interrupt.resolve(record.removalDeadline);
@@ -574,14 +607,30 @@ export class PluginLifecycleCoordinator<TData, TPlugin> {
return record.latestStructuralKind !== "load";
}
- private dropPendingDataChanges(record: IPluginLifecycleRecord<TData, TPlugin>) {
+ private getFinalStructuralKind(record: IPluginLifecycleRecord<TData, TPlugin>) {
+ let kind = record.currentTask && this.isStructural(record.currentTask.kind) ? record.currentTask.kind : undefined;
+ record.tasks.forEach((task) => {
+ if (this.isStructural(task.kind)) {
+ kind = task.kind;
+ }
+ });
+ return kind;
+ }
+
+ private takePendingDataChange(record: IPluginLifecycleRecord<TData, TPlugin>) {
+ let pending: IPluginLifecycleTask<TData> | undefined;
record.tasks = record.tasks.filter((task) => {
if (task.kind !== "dataChange") {
return true;
}
- task.waiters.forEach((resolve) => resolve());
+ if (pending) {
+ pending.waiters.push(...task.waiters);
+ } else {
+ pending = task;
+ }
return false;
});
+ return pending;
}
private isStructural(kind: TPluginLifecycleTaskKind): kind is TPluginStructuralTaskKind {
diff --git a/kernel/api/setting.go b/kernel/api/setting.go
index c6ff5e4e92..7197d7e809 100644
--- a/kernel/api/setting.go
+++ b/kernel/api/setting.go
@@ -175,12 +175,19 @@ func setBazaar(c *gin.Context) {
} else if model.OnKernelPluginsStop != nil {
model.OnKernelPluginsStop()
}
- model.PushReloadAllEnabledPlugins(newPetalsEnabled, app)
+ model.PushReloadAllEnabledPlugins(newPetalsEnabled, bazaarPluginReloadExcludeApp(newPetalsEnabled, app))
}
ret.Data = bazaar
}
+func bazaarPluginReloadExcludeApp(enabled bool, app string) string {
+ if enabled {
+ return app
+ }
+ return ""
+}
+
func setAI(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
diff --git a/kernel/api/setting_test.go b/kernel/api/setting_test.go
new file mode 100644
index 0000000000..0198bc58b7
--- /dev/null
+++ b/kernel/api/setting_test.go
@@ -0,0 +1,37 @@
+// SiYuan - From thought to insight, with agents
+// Copyright (c) 2020-present, b3log.org
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+package api
+
+import "testing"
+
+func TestBazaarPluginReloadExcludeApp(t *testing.T) {
+ for _, test := range []struct {
+ name string
+ enabled bool
+ app string
+ want string
+ }{
+ {name: "enable excludes requesting app", enabled: true, app: "current-app", want: "current-app"},
+ {name: "disable includes requesting app", enabled: false, app: "current-app", want: ""},
+ } {
+ t.Run(test.name, func(t *testing.T) {
+ if got := bazaarPluginReloadExcludeApp(test.enabled, test.app); got != test.want {
+ t.Fatalf("unexpected excluded app: got %q, want %q", got, test.want)
+ }
+ })
+ }
+}
diff --git a/kernel/model/push_reload.go b/kernel/model/push_reload.go
index 3921035362..c06998bbf7 100644
--- a/kernel/model/push_reload.go
+++ b/kernel/model/push_reload.go
@@ -94,7 +94,7 @@ func PushReloadPlugin(uninstallPluginNameSet, unloadPluginNameSet, reloadPluginS
util.BroadcastByTypeAndExcludeApp(excludeApp, "main", "reloadPlugin", 0, "", payload)
}
-// PushReloadAllEnabledPlugins 向所有其他前端推送已启用插件的全局启用或禁用状态。
+// PushReloadAllEnabledPlugins 向前端推送已启用插件的全局启用或禁用状态。
func PushReloadAllEnabledPlugins(enabled bool, excludeApp string) {
pluginNameSet := hashset.New()
for _, petal := range getPetals() {