File tree Expand file tree Collapse file tree
nebula-dsl/src/main/kotlin/com/orbitalhq/nebula Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class StackRunner(private val config: NebulaConfig = NebulaConfig()) {
1919 private val _stackState = ConcurrentHashMap <StackName , Map <String , ComponentInfo <* >>>()
2020
2121 fun submit (submittedStack : NebulaStackWithSource , name : StackName = submittedStack.name, startAsync : Boolean = false): Flux <StackStateEvent > {
22- val stack = this .stacks.compute(name) { key, existingSpec ->
22+ val storedStack = this .stacks.compute(name) { key, existingSpec ->
2323 if (existingSpec != null ) {
2424 if (existingSpec.source == submittedStack.source) {
2525 logger.info { " Received duplicate submission for spec $key - reusing existing stack" }
@@ -31,15 +31,23 @@ class StackRunner(private val config: NebulaConfig = NebulaConfig()) {
3131 }
3232 submittedStack
3333 } ? : error(" After submitting stack $name , no stack was created." )
34- if (startAsync) {
35- thread {
34+
35+ // Only start if the stack that got stored was the one that got submitted.
36+ // Otherwise it's someone elses stack, and already running
37+ if (submittedStack == storedStack) {
38+ if (startAsync) {
39+ thread {
40+ start(name)
41+ }
42+ } else {
3643 start(name)
3744 }
3845 } else {
39- start( name)
46+ logger.info { " Not starting stack ${storedStack. name} as stack is already running " }
4047 }
4148
4249
50+
4351 return stackEvents(name)
4452 }
4553
You can’t perform that action at this time.
0 commit comments