@@ -198,7 +198,7 @@ func (srv *Server) ContainerKill(job *engine.Job) engine.Status {
198198 return engine .StatusOK
199199}
200200
201- func (srv * Server ) EvictListener (from string ) {
201+ func (srv * Server ) EvictListener (from int64 ) {
202202 srv .Lock ()
203203 if old , ok := srv .listeners [from ]; ok {
204204 delete (srv .listeners , from )
@@ -208,12 +208,12 @@ func (srv *Server) EvictListener(from string) {
208208}
209209
210210func (srv * Server ) Events (job * engine.Job ) engine.Status {
211- if len (job .Args ) != 1 {
212- return job .Errorf ("Usage: %s FROM " , job .Name )
211+ if len (job .Args ) != 0 {
212+ return job .Errorf ("Usage: %s" , job .Name )
213213 }
214214
215215 var (
216- from = job . Args [ 0 ]
216+ from = time . Now (). UTC (). UnixNano ()
217217 since = job .GetenvInt64 ("since" )
218218 until = job .GetenvInt64 ("until" )
219219 timeout = time .NewTimer (time .Unix (until , 0 ).Sub (time .Now ()))
@@ -2432,7 +2432,7 @@ func NewServer(eng *engine.Engine, config *daemonconfig.Config) (*Server, error)
24322432 pullingPool : make (map [string ]chan struct {}),
24332433 pushingPool : make (map [string ]chan struct {}),
24342434 events : make ([]utils.JSONMessage , 0 , 64 ), //only keeps the 64 last events
2435- listeners : make (map [string ]chan utils.JSONMessage ),
2435+ listeners : make (map [int64 ]chan utils.JSONMessage ),
24362436 running : true ,
24372437 }
24382438 daemon .SetServer (srv )
@@ -2494,7 +2494,7 @@ type Server struct {
24942494 pullingPool map [string ]chan struct {}
24952495 pushingPool map [string ]chan struct {}
24962496 events []utils.JSONMessage
2497- listeners map [string ]chan utils.JSONMessage
2497+ listeners map [int64 ]chan utils.JSONMessage
24982498 Eng * engine.Engine
24992499 running bool
25002500}
0 commit comments