Skip to content

Commit

Permalink
Adding better checking for streams
Browse files Browse the repository at this point in the history
  • Loading branch information
COMTOP1 committed Feb 20, 2024
1 parent 586175f commit 05e8931
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion forwarder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func (v *Views) run(config Config, interrupt chan os.Signal) {
continue
}
case "status":
_, ok := v.cache.Get(fmt.Sprintf("%s_1", t.Unique))
_, ok := v.cache.Get(fmt.Sprintf("%s_1_%s", t.Unique, finishChannelNameAppend))
if !ok {
kill := v.errorResponse(fmt.Errorf("failed to get status, invalid unique: %s", t.Unique), c, m.ID)
if kill {
Expand Down
18 changes: 18 additions & 0 deletions recorder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,15 @@ func (v *Views) run(config Config, interrupt chan os.Signal) {
continue
}
case "status":
_, ok := v.cache.Get(fmt.Sprintf("%s_%s", t.Unique, finishChannelNameAppend))
if !ok {
kill := v.errorResponse(fmt.Errorf("failed to get status recorder, invalid unique: %s", t.Unique), c, m.ID)
if kill {
return
}
continue
}

out, err = v.status(t)
if err != nil {
kill := v.errorResponse(fmt.Errorf("failed to get status recorder: %w", err), c, m.ID)
Expand All @@ -315,6 +324,15 @@ func (v *Views) run(config Config, interrupt chan os.Signal) {
continue
}
case "stop":
_, ok := v.cache.Get(fmt.Sprintf("%s_%s", t.Unique, finishChannelNameAppend))
if !ok {
kill := v.errorResponse(fmt.Errorf("failed to stop recorder, invalid unique: %s", t.Unique), c, m.ID)
if kill {
return
}
continue
}

err = v.stop(t)
if err != nil {
kill := v.errorResponse(fmt.Errorf("failed to stop recorder: %w", err), c, m.ID)
Expand Down

0 comments on commit 05e8931

Please sign in to comment.