fix gateway restart (#593)
This commit is contained in:
committed by
GitHub
Unverified
parent
8029b507ba
commit
2471228cc2
@@ -41,9 +41,10 @@ function scheduleGatewayChannelRestart(ctx: HostApiContext, reason: string): voi
|
|||||||
void reason;
|
void reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep reload-first for feishu to avoid restart storms when channel auth/network is flaky.
|
// Plugin-based channels require a full Gateway process restart to properly
|
||||||
// GatewayManager.reload() already falls back to restart when reload is unhealthy.
|
// initialize / tear-down plugin connections. SIGUSR1 in-process reload is
|
||||||
const FORCE_RESTART_CHANNELS = new Set(['dingtalk', 'wecom', 'whatsapp']);
|
// not sufficient for channel plugins (see restartGatewayForAgentDeletion).
|
||||||
|
const FORCE_RESTART_CHANNELS = new Set(['dingtalk', 'wecom', 'whatsapp', 'feishu', 'qqbot']);
|
||||||
|
|
||||||
function scheduleGatewayChannelSaveRefresh(
|
function scheduleGatewayChannelSaveRefresh(
|
||||||
ctx: HostApiContext,
|
ctx: HostApiContext,
|
||||||
|
|||||||
@@ -242,8 +242,14 @@ export class GatewayManager extends EventEmitter {
|
|||||||
await this.connect(port, externalToken);
|
await this.connect(port, externalToken);
|
||||||
},
|
},
|
||||||
onConnectedToExistingGateway: () => {
|
onConnectedToExistingGateway: () => {
|
||||||
|
// If the existing gateway is actually our own spawned UtilityProcess
|
||||||
|
// (e.g. after a self-restart code=1012), keep ownership so that
|
||||||
|
// stop() can still terminate the process during a restart() cycle.
|
||||||
|
const isOwnProcess = this.process?.pid != null && this.ownsProcess;
|
||||||
|
if (!isOwnProcess) {
|
||||||
this.ownsProcess = false;
|
this.ownsProcess = false;
|
||||||
this.setStatus({ pid: undefined });
|
this.setStatus({ pid: undefined });
|
||||||
|
}
|
||||||
this.startHealthCheck();
|
this.startHealthCheck();
|
||||||
},
|
},
|
||||||
waitForPortFree: async (port) => {
|
waitForPortFree: async (port) => {
|
||||||
|
|||||||
@@ -1361,9 +1361,10 @@ function registerGatewayHandlers(
|
|||||||
* For checking package status and channel configuration
|
* For checking package status and channel configuration
|
||||||
*/
|
*/
|
||||||
function registerOpenClawHandlers(gatewayManager: GatewayManager): void {
|
function registerOpenClawHandlers(gatewayManager: GatewayManager): void {
|
||||||
// Keep reload-first for feishu to avoid restart storms when channel auth/network is flaky.
|
// Plugin-based channels require a full Gateway process restart to properly
|
||||||
// GatewayManager.reload() already falls back to restart when reload is unhealthy.
|
// initialize / tear-down plugin connections. SIGUSR1 in-process reload is
|
||||||
const forceRestartChannels = new Set(['dingtalk', 'wecom', 'whatsapp']);
|
// not sufficient for channel plugins (see restartGatewayForAgentDeletion).
|
||||||
|
const forceRestartChannels = new Set(['dingtalk', 'wecom', 'whatsapp', 'feishu', 'qqbot']);
|
||||||
|
|
||||||
const scheduleGatewayChannelRestart = (reason: string): void => {
|
const scheduleGatewayChannelRestart = (reason: string): void => {
|
||||||
if (gatewayManager.getStatus().state !== 'stopped') {
|
if (gatewayManager.getStatus().state !== 'stopped') {
|
||||||
|
|||||||
Reference in New Issue
Block a user