Merge polecat/furiosa: fix lifecycle parser order (gt-rixa)
Check restart/shutdown before cycle to avoid matching 'lifecycle:' prefix. Use ' cycle' (with leading space) for word boundary matching. Resolved conflict: fixed variable name (title → subject).
This commit is contained in:
@@ -83,12 +83,15 @@ func (d *Daemon) parseLifecycleRequest(msg *BeadsMessage) *LifecycleRequest {
|
||||
var action LifecycleAction
|
||||
var from string
|
||||
|
||||
if strings.Contains(subject, "cycle") || strings.Contains(subject, "cycling") {
|
||||
action = ActionCycle
|
||||
} else if strings.Contains(subject, "restart") {
|
||||
// Check restart/shutdown before cycle.
|
||||
// Note: Can't use Contains(subject, "cycle") because "lifecycle:" contains "cycle".
|
||||
// Use " cycle" (with leading space) to match the word, not the prefix.
|
||||
if strings.Contains(subject, "restart") {
|
||||
action = ActionRestart
|
||||
} else if strings.Contains(subject, "shutdown") || strings.Contains(subject, "stop") {
|
||||
action = ActionShutdown
|
||||
} else if strings.Contains(subject, " cycle") || strings.Contains(subject, "cycling") {
|
||||
action = ActionCycle
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user