mirror of https://github.com/docker/docs.git
Merge pull request #17458 from LK4D4/unnec_err
Remove unnecessary error returns
This commit is contained in:
commit
7de2b49ac8
|
@ -955,14 +955,12 @@ func (daemon *Daemon) stats(c *Container) (*execdriver.ResourceStats, error) {
|
||||||
return daemon.execDriver.Stats(c.ID)
|
return daemon.execDriver.Stats(c.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (daemon *Daemon) subscribeToContainerStats(c *Container) (chan interface{}, error) {
|
func (daemon *Daemon) subscribeToContainerStats(c *Container) chan interface{} {
|
||||||
ch := daemon.statsCollector.collect(c)
|
return daemon.statsCollector.collect(c)
|
||||||
return ch, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (daemon *Daemon) unsubscribeToContainerStats(c *Container, ch chan interface{}) error {
|
func (daemon *Daemon) unsubscribeToContainerStats(c *Container, ch chan interface{}) {
|
||||||
daemon.statsCollector.unsubscribe(c, ch)
|
daemon.statsCollector.unsubscribe(c, ch)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (daemon *Daemon) changes(container *Container) ([]archive.Change, error) {
|
func (daemon *Daemon) changes(container *Container) ([]archive.Change, error) {
|
||||||
|
|
|
@ -35,11 +35,6 @@ func (daemon *Daemon) ContainerStats(prefixOrName string, config *ContainerStats
|
||||||
return json.NewEncoder(config.OutStream).Encode(&types.Stats{})
|
return json.NewEncoder(config.OutStream).Encode(&types.Stats{})
|
||||||
}
|
}
|
||||||
|
|
||||||
updates, err := daemon.subscribeToContainerStats(container)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if config.Stream {
|
if config.Stream {
|
||||||
// Write an empty chunk of data.
|
// Write an empty chunk of data.
|
||||||
// This is to ensure that the HTTP status code is sent immediately,
|
// This is to ensure that the HTTP status code is sent immediately,
|
||||||
|
@ -65,6 +60,7 @@ func (daemon *Daemon) ContainerStats(prefixOrName string, config *ContainerStats
|
||||||
|
|
||||||
enc := json.NewEncoder(config.OutStream)
|
enc := json.NewEncoder(config.OutStream)
|
||||||
|
|
||||||
|
updates := daemon.subscribeToContainerStats(container)
|
||||||
defer daemon.unsubscribeToContainerStats(container, updates)
|
defer daemon.unsubscribeToContainerStats(container, updates)
|
||||||
|
|
||||||
noStreamFirstFrame := true
|
noStreamFirstFrame := true
|
||||||
|
|
Loading…
Reference in New Issue