Skip to content

Commit

Permalink
feat: using async like contract
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsmejkal committed Jul 4, 2024
1 parent 94597b8 commit 71893f9
Show file tree
Hide file tree
Showing 9 changed files with 490 additions and 215 deletions.
30 changes: 0 additions & 30 deletions adapter.go

This file was deleted.

8 changes: 4 additions & 4 deletions looper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ import "context"
// ....
// }
type BaseLooper struct {
runner RunnerCloser
runner Runner
}

// Run executes runners workload. Pipelines are starting Run method in separated goroutine.
// Runner must report its readiness using given callback
func (l *BaseLooper) Run(ctx context.Context, ready ReadyFunc) error {
return l.runner.Run(ctx, ready)
func (l *BaseLooper) Run(ctx context.Context) error {
return l.runner.Run(ctx)
}

// Close method triggers graceful shutdown on the task. It should block till task is properly closed.
// When Close timeout is exceeded then given context is canceled.
func (l *BaseLooper) Close(ctx context.Context) error {
return l.runner.Close(ctx)
return RunnerClose(ctx, l.runner)
}

func NewBaseLooper(looper func(ctx context.Context, loop *Loop) error) *BaseLooper {
Expand Down
Loading

0 comments on commit 71893f9

Please sign in to comment.