1
0
mirror of https://github.com/docker/docs.git synced 2026-11-05 00:14:17 +03:00

add heartbeat to attach

Docker-DCO-1.1-Signed-off-by: Aaron Feng <aaron.feng@gmail.com> (github: aaronfeng)
This commit is contained in:
Aaron Feng
2014-06-14 05:08:59 -07:00
parent 1946328111
commit cfb7f6188b

View File

@@ -1,6 +1,7 @@
package backends
import (
"time"
"fmt"
"github.com/docker/libswarm/beam"
)
@@ -55,9 +56,15 @@ func (c *ec2Client) stop(ctx *beam.Message) error {
func (c *ec2Client) attach(ctx *beam.Message) error {
fmt.Println("*** ec2 OnAttach ***")
ctx.Ret.Send(&beam.Message{Verb: beam.Ack, Ret: c.Server})
for {
time.Sleep(1 * time.Second)
(&beam.Object{ctx.Ret}).Log("ec2: heartbeat")
}
return nil
}
func Ec2() beam.Sender {
backend := beam.NewServer()
backend.OnSpawn(beam.Handler(func(ctx *beam.Message) error {