danielgross / whatsapp-gpt

MIT License
3.07k stars 596 forks source link

go/connector: potential to lose signal due to unbuffered signal channel #13

Open odeke-em opened 1 year ago

odeke-em commented 1 year ago

The code in https://github.com/danielgross/whatsapp-gpt/blob/d12693276e1e88d5d335276aa42bcfd849d56023/main.go#L110-L112 creates an unbuffered channel but unfortunately that can cause a signal to be lost. It should be have a capacity of at least 1 given that we are waiting for just 1 signal and the advisory at https://pkg.go.dev/os/signal#Notify

Screen Shot 2022-12-04 at 8 30 02 PM