Remove unneeded closer interface

This commit is contained in:
andig 2020-12-27 12:24:34 +01:00
parent baf2f68b88
commit c92e8669cc
7 changed files with 0 additions and 28 deletions

View file

@ -111,8 +111,3 @@ type VehicleRange interface {
type Climater interface {
Climater() (active bool, outsideTemp float64, targetTemp float64, err error)
}
// Closer ends open sessions or connections
type Closer interface {
Close() error
}

View file

@ -32,12 +32,9 @@ func runCharger(cmd *cobra.Command, args []string) {
}
if err := cp.configureChargers(conf); err != nil {
cp.Close() // cleanup any open sessions
log.FATAL.Fatal(err)
}
defer cp.Close() // cleanup on exit
chargers := cp.chargers
if len(args) == 1 {
arg := args[0]

View file

@ -152,12 +152,3 @@ func (cp *ConfigProvider) configureVehicles(conf config) error {
return nil
}
// Close performs cleanup activities on all entities maintained by the config provider
func (cp *ConfigProvider) Close() {
for _, o := range cp.vehicles {
if c, ok := o.(api.Closer); ok {
c.Close()
}
}
}

View file

@ -35,12 +35,9 @@ func runDump(cmd *cobra.Command, args []string) {
site, err := loadConfig(conf)
if err != nil {
cp.Close() // cleanup any open sessions
log.FATAL.Fatal(err)
}
defer cp.Close() // cleanup on exit
d := dumper{len: 2}
d.Header("config", "=")

View file

@ -32,12 +32,9 @@ func runMeter(cmd *cobra.Command, args []string) {
}
if err := cp.configureMeters(conf); err != nil {
cp.Close() // cleanup any open sessions
log.FATAL.Fatal(err)
}
defer cp.Close() // cleanup on exit
meters := cp.meters
if len(args) == 1 {
arg := args[0]

View file

@ -161,7 +161,6 @@ func run(cmd *cobra.Command, args []string) {
// setup loadpoints
site, err := loadConfig(conf)
if err != nil {
cp.Close()
log.FATAL.Fatal(err)
}
@ -236,7 +235,6 @@ func run(cmd *cobra.Command, args []string) {
<-signalC // wait for signal
close(stopC) // signal loop to end
<-exitC // wait for loop to end
cp.Close() // cleanup
os.Exit(1)
}()

View file

@ -32,12 +32,9 @@ func runVehicle(cmd *cobra.Command, args []string) {
}
if err := cp.configureVehicles(conf); err != nil {
cp.Close() // cleanup any open sessions
log.FATAL.Fatal(err)
}
defer cp.Close() // cleanup on exit
vehicles := cp.vehicles
if len(args) == 1 {
arg := args[0]