chore(proto): Add ping request.

Signed-off-by: Bo-Yi Wu <[email protected]>
This commit is contained in:
Bo-Yi Wu authored and Jason Song committed 2022-11-24 15:36:54 +08:00
1 parent 14a345504f
commit 4d7ef95d40
8 files changed
+179 -7

No files matched your search

+28 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"time"
"gitea.com/gitea/act_runner/client"
"gitea.com/gitea/act_runner/engine"
"github.com/joho/godotenv"
@@ -164,7 +165,33 @@ func runDaemon(ctx context.Context, input *Input) func(cmd *cobra.Command, args
}
time.Sleep(time.Second)
} else {
log.Debugln("successfully pinged the docker daemon")
log.Infoln("successfully pinged the docker daemon")
break
}
}
cli := client.New(
cfg.Client.Address,
cfg.Client.Secret,
cfg.Client.SkipVerify,
)
for {
err := cli.Ping(ctx, cfg.Runner.Name)
select {
case <-ctx.Done():
return nil
default:
}
if ctx.Err() != nil {
break
}
if err != nil {
log.WithError(err).
Errorln("cannot ping the remote server")
time.Sleep(time.Second)
} else {
log.Infoln("successfully pinged the remote server")
break
}
}