Closed andig closed 4 years ago
In https://github.com/andig/evcc/pull/164 user reports that application gets blocked during reading BT device if the device is not connected. The code looks somewhat like this:
dev, err := nrgble.FindDevice(nrg.adapter, nrg.macaddress) if err != nil { return nil, fmt.Errorf("findDevice: %s", err) } err = nrgble.Connect(dev, nrg.agent, nrg.device) if err != nil { return nil, err } char, err := nrg.dev.GetCharByUUID(service) if err != nil { nrg.close() return err } b, err := char.ReadValue(map[string]interface{}{}) if err != nil { nrg.close() return err }
I couldn't find any timeout or context in the codebase that could be applicable. How should this situation be handled?
I have meanwhile found the cancel result of api.Discover- please excuse the confusion.
cancel
api.Discover
In https://github.com/andig/evcc/pull/164 user reports that application gets blocked during reading BT device if the device is not connected. The code looks somewhat like this:
I couldn't find any timeout or context in the codebase that could be applicable. How should this situation be handled?