Skip to content

Commit b5437f7

Browse files
committed
refactor: simplify nil channel handling in Start()
Remove unnecessary channel creation for nil initialPromptReady. In Go's select statement, nil channel cases are simply skipped (never selected), so we don't need to create a new channel that blocks forever - the nil channel already has the desired behavior. Addresses PR review feedback.
1 parent 86c9d91 commit b5437f7

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

lib/screentracker/pty_conversation.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,8 @@ func (c *PTYConversation) Start(ctx context.Context) {
137137
ticker := c.cfg.Clock.NewTicker(c.cfg.SnapshotInterval)
138138
defer ticker.Stop()
139139

140-
// Create a nil channel if no initial prompt - select will never receive from it
140+
// If nil, the select case below is simply never chosen (nil channels are skipped in select)
141141
initialPromptReady := c.initialPromptReady
142-
if initialPromptReady == nil {
143-
initialPromptReady = make(chan struct{})
144-
// Don't close it - we want it to block forever
145-
}
146142

147143
for {
148144
select {

0 commit comments

Comments
 (0)