Close response listeners

This commit is contained in:
Finn 2020-12-11 03:42:26 -08:00
parent 0f7100527b
commit e8e52b82a1
2 changed files with 2 additions and 0 deletions

View file

@ -42,6 +42,7 @@ var registerCmd = &cobra.Command{
go s.Listen(nil) go s.Listen(nil)
r := <-s.GetResponseListener(requestID) r := <-s.GetResponseListener(requestID)
defer s.CloseResponseListener(requestID)
account, err := r.Data.MarshalJSON() account, err := r.Data.MarshalJSON()
if err != nil { if err != nil {
log.Fatal("error rendering response:", err) log.Fatal("error rendering response:", err)

View file

@ -47,6 +47,7 @@ var verify = &cobra.Command{
go s.Listen(nil) go s.Listen(nil)
r := <-s.GetResponseListener(requestID) r := <-s.GetResponseListener(requestID)
defer s.CloseResponseListener(requestID)
account, err := r.Data.MarshalJSON() account, err := r.Data.MarshalJSON()
if err != nil { if err != nil {
log.Fatal("error rendering response:", err) log.Fatal("error rendering response:", err)