Default events since to current time

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 74c12aa429)
This commit is contained in:
Brian Goff
2015-06-04 19:47:46 -07:00
committed by Jessica Frazelle
parent 5291de79ae
commit 1d3f7cc012
4 changed files with 19 additions and 0 deletions
+4
View File
@@ -398,6 +398,7 @@ func (s *Server) getEvents(version version.Version, w http.ResponseWriter, r *ht
}
until = u
}
timer := time.NewTimer(0)
timer.Stop()
if until > 0 {
@@ -456,6 +457,9 @@ func (s *Server) getEvents(version version.Version, w http.ResponseWriter, r *ht
}
current, l := es.Subscribe()
if since == -1 {
current = nil
}
defer es.Evict(l)
for _, ev := range current {
if ev.Time < since {
+5
View File
@@ -63,7 +63,12 @@ Again the output container IDs have been shortened for the purposes of this docu
2015-01-28T20:25:45.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) die
2015-01-28T20:25:46.000000000-08:00 c21f6c22ba27: (from whenry/testimage:latest) stop
If you do not provide the --since option, the command returns only new and/or
live events.
# HISTORY
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
based on docker.com source material and internal work.
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
June 2015, updated by Brian Goff <cpuguy83@gmail.com>
@@ -1115,6 +1115,9 @@ and Docker images will report:
untag, delete
If you do not provide the --since option, the command
returns only new and/or live events.
#### Filtering
The filtering flag (`-f` or `--filter`) format is of "key=value". If you would like to use
@@ -563,3 +563,10 @@ func (s *DockerSuite) TestEventsStreaming(c *check.C) {
// ignore, done
}
}
// #13753
func (s *DockerSuite) TestEventsDefaultEmpty(c *check.C) {
dockerCmd(c, "run", "-d", "busybox")
out, _ := dockerCmd(c, "events", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
c.Assert(strings.TrimSpace(out), check.Equals, "")
}