release: harden plugin deployment and recovery
Business Plugins CI / check (plugin-admin) (push) Successful in 1m37s
Business Plugins CI / check (subscription-admin) (push) Successful in 1m31s

This commit is contained in:
Qiufeng
2026-08-30 13:14:22 +08:00
parent ada4ab3c21
commit d3ff9be315
16 changed files with 259 additions and 50 deletions
+13 -6
View File
@@ -44,7 +44,7 @@ import (
const (
pluginID = "qiu.plugin-admin"
subscriptionPluginID = "qiu.subscription-admin"
pluginVersion = "1.1.0"
pluginVersion = "1.1.1"
sessionCookieName = "plugin_admin_session"
maxJSONBytes = 2 << 20
maxPackageBytes = 128 << 20
@@ -2668,18 +2668,25 @@ func (a *app) startRevision(p *pluginRecord, revisionID, processKey string) (str
probe.Endpoint = endpoint
var probeErr error
attempts := 1
probeDelay := 50 * time.Millisecond
var startupDeadline time.Time
if pluginManifest.Backend.Command != "" {
// A freshly spawned process can need a short interval before binding its
// port. Retry the probe within the bounded startup window.
attempts = 20
// A freshly spawned interpreter-backed process can need several seconds
// before binding its port (notably on macOS under concurrent test load).
// Keep the window bounded while avoiding a fixed one-second flake.
attempts = 100
startupDeadline = time.Now().Add(5 * time.Second)
}
for attempt := 0; attempt < attempts; attempt++ {
if !startupDeadline.IsZero() && time.Now().After(startupDeadline) {
break
}
probeErr = a.checkPluginHealth(&probe)
if probeErr == nil {
break
}
if attempt+1 < attempts {
time.Sleep(50 * time.Millisecond)
if attempt+1 < attempts && (startupDeadline.IsZero() || time.Now().Add(probeDelay).Before(startupDeadline)) {
time.Sleep(probeDelay)
}
}
if probeErr != nil {