Skip to content

Commit d335a34

Browse files
miltalexteo
authored andcommitted
[core] remove goroutine from transition_configure
1 parent 6b6d037 commit d335a34

1 file changed

Lines changed: 0 additions & 47 deletions

File tree

core/environment/transition_configure.go

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -190,52 +190,5 @@ func (t ConfigureTransition) do(env *Environment) (err error) {
190190
return tasksStateErrors
191191
}
192192

193-
// This will subscribe to workflow state change. In case of workflow state
194-
// ERROR will transition environment to ERROR state. The goroutine starts
195-
// after a successful transition to CONFIGURE in order to handle only ERROR
196-
// states triggered by mesos.(TASK_LOST,TASK_KILLED,TASK_FAILED,TASK_ERROR)
197-
go func() {
198-
wf := env.Workflow()
199-
notify := make(chan task.State)
200-
subscriptionId := uuid.NewUUID().String()
201-
env.wfAdapter.SubscribeToStateChange(subscriptionId, notify)
202-
defer env.wfAdapter.UnsubscribeFromStateChange(subscriptionId)
203-
204-
wfState := wf.GetState()
205-
if wfState != task.ERROR {
206-
WORKFLOW_STATE_LOOP:
207-
for {
208-
select {
209-
case wfState = <-notify:
210-
if wfState == task.DONE {
211-
break WORKFLOW_STATE_LOOP
212-
}
213-
// We kill the goroutine on a reset or a teardown
214-
// of the environment
215-
if wfState == task.STANDBY {
216-
break WORKFLOW_STATE_LOOP
217-
}
218-
if wfState == task.ERROR {
219-
prvState := env.CurrentState()
220-
env.setState(wfState.String())
221-
if prvState == "RUNNING" {
222-
taskmanMessage := task.NewTransitionTaskMessage(
223-
env.Workflow().GetTasks(),
224-
task.RUNNING.String(),
225-
task.STOP.String(),
226-
task.CONFIGURED.String(),
227-
nil,
228-
env.Id(),
229-
)
230-
t.taskman.MessageChannel <- taskmanMessage
231-
<-env.stateChangedCh
232-
}
233-
break WORKFLOW_STATE_LOOP
234-
}
235-
}
236-
}
237-
}
238-
}()
239-
240193
return
241194
}

0 commit comments

Comments
 (0)