Rework task create and cleanup flow

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko
2021-08-26 16:35:56 -07:00
parent 7c4ead285d
commit fb5f6ce3c9
3 changed files with 107 additions and 57 deletions

View File

@@ -60,7 +60,7 @@ type binary struct {
bundle *Bundle
}
func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_ *shimTask, err error) {
func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_ *shim, err error) {
args := []string{"-id", b.bundle.ID}
switch logrus.GetLevel() {
case logrus.DebugLevel, logrus.TraceLevel:
@@ -128,12 +128,9 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_
f.Close()
}
client := ttrpc.NewClient(conn, ttrpc.WithOnClose(onCloseWithShimLog))
return &shimTask{
shim: &shim{
bundle: b.bundle,
client: client,
},
task: task.NewTaskClient(client),
return &shim{
bundle: b.bundle,
client: client,
}, nil
}