Преглед изворни кода

Merge pull request #5794 from unclejack/speed_up_ps

don't call sort for every add in daemon/history
Victor Vieux пре 11 година
родитељ
комит
b561f0398a
2 измењених фајлова са 4 додато и 0 уклоњено
  1. 1 0
      daemon/daemon.go
  2. 3 0
      daemon/history.go

+ 1 - 0
daemon/daemon.go

@@ -85,6 +85,7 @@ func (daemon *Daemon) List() []*Container {
 	for e := daemon.containers.Front(); e != nil; e = e.Next() {
 		containers.Add(e.Value.(*Container))
 	}
+	containers.Sort()
 	return *containers
 }
 

+ 3 - 0
daemon/history.go

@@ -26,5 +26,8 @@ func (history *History) Swap(i, j int) {
 
 func (history *History) Add(container *Container) {
 	*history = append(*history, container)
+}
+
+func (history *History) Sort() {
 	sort.Sort(history)
 }