2 Commits

Author SHA1 Message Date
db85184dca Add .drone.yml
Some checks reported errors
continuous-integration/drone Build encountered an error
2022-10-26 11:29:16 +02:00
a59a278140 with callback instead 2022-09-21 22:19:54 +02:00
2 changed files with 16 additions and 9 deletions

9
.drone.yml Executable file
View File

@@ -0,0 +1,9 @@
kind: pipeline
type: docker
name: "test"
steps:
- name: test
image: bash
commands:
- echo 'Run tests'

View File

@@ -34,15 +34,10 @@ func NewManager() *Manager {
type ComponentsAreReady struct {
}
func (m *Manager) RunNonBlocking(ctx context.Context, readyChan chan ComponentsAreReady) error {
type CleanupFunc func(ctx context.Context) error
func (m *Manager) RunNonBlocking(ctx context.Context, readyChan chan ComponentsAreReady) (CleanupFunc, error) {
go func() error {
defer func() {
ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
err := m.shutdown(ctx)
if err != nil {
panic(err)
}
}()
m.initLifetime()
err := m.init(ctx)
if err != nil {
@@ -63,7 +58,10 @@ func (m *Manager) RunNonBlocking(ctx context.Context, readyChan chan ComponentsA
return nil
}()
return nil
return func(ctx context.Context) error {
return m.shutdown(ctx)
}, nil
}
func (m *Manager) Run(ctx context.Context) error {