fix: add delay in OnStackStart for status refresh timing
The goroutine fires immediately but needs the stack manager's state to reflect 'running' before checking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package integrations
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"gitea.dooplex.hu/admin/felhom-controller/internal/stacks"
|
"gitea.dooplex.hu/admin/felhom-controller/internal/stacks"
|
||||||
)
|
)
|
||||||
@@ -56,7 +57,12 @@ func (m *Manager) OnStackStop(_ context.Context, stackName string) {
|
|||||||
|
|
||||||
// OnStackStart is called when a stack starts.
|
// OnStackStart is called when a stack starts.
|
||||||
// Re-applies integrations that were previously enabled but are not currently active.
|
// Re-applies integrations that were previously enabled but are not currently active.
|
||||||
|
// Waits briefly for the stack manager to refresh container state.
|
||||||
func (m *Manager) OnStackStart(_ context.Context, stackName string) {
|
func (m *Manager) OnStackStart(_ context.Context, stackName string) {
|
||||||
|
// Brief delay so the stack manager's periodic status refresh
|
||||||
|
// picks up the new container state (runs every 30s).
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
|
||||||
m.mu.Lock()
|
m.mu.Lock()
|
||||||
defer m.mu.Unlock()
|
defer m.mu.Unlock()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user