mirror of
https://github.com/clearlinux/docker.git
synced 2026-08-27 11:16:53 +00:00
Default events since to current time
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 74c12aa429)
This commit is contained in:
committed by
Jessica Frazelle
parent
5291de79ae
commit
1d3f7cc012
@@ -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 {
|
||||
|
||||
@@ -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, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user