Skip to content

Commit

Permalink
More debug messages in sink
Browse files Browse the repository at this point in the history
  • Loading branch information
samuell committed Aug 16, 2016
1 parent 1c7c086 commit fc500cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ func (pl *PipelineRunner) Run() {
os.Exit(1)
}
for i, proc := range pl.processes {
Debug.Printf("PipelineRunner: Looping over process %d: %v ...\n", i, proc)
if i < len(pl.processes)-1 {
Debug.Printf("PipelineRunner: Starting process %d in new go-routine: %v\n", i, proc)
Debug.Printf("PipelineRunner: Starting process %d of type %v: in new go-routine...\n", i, reflect.TypeOf(proc))
go proc.Run()
} else {
Debug.Printf("PipelineRunner: Starting process %d: in main go-routine: %v\n", i, proc)
Debug.Printf("PipelineRunner: Starting process %d of type %v: in main go-routine...\n", i, reflect.TypeOf(proc))
proc.Run()
}
}
Expand Down
4 changes: 4 additions & 0 deletions sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ func (proc *Sink) Connect(ch chan interface{}) {
// Execute the Sink component
func (proc *Sink) Run() {
ok := true
Debug.Printf("Length of inPorts: %d\n", len(proc.inPorts))
for len(proc.inPorts) > 0 {
for i, ich := range proc.inPorts {
select {
case _, ok = <-ich:
Debug.Printf("Received on in-port %d in sink\n", i)
if !ok {
Debug.Printf("Port on %d not ok, in sink\n", i)
proc.deleteInPortAtKey(i)
continue
}
Expand All @@ -34,6 +37,7 @@ func (proc *Sink) Run() {
}

func (proc *Sink) deleteInPortAtKey(i int) {
Debug.Println("Deleting inport at key", i, "in sink")
proc.inPorts = append(proc.inPorts[:i], proc.inPorts[i+1:]...)
}

Expand Down

0 comments on commit fc500cc

Please sign in to comment.