Skip to content

Commit

Permalink
Merge pull request #9 from getoutreach/async
Browse files Browse the repository at this point in the history
feat: using async like contract
  • Loading branch information
pavelsmejkal authored Sep 16, 2024
2 parents 94597b8 + 71893f9 commit 1db89a5
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 1db89a5

Please sign in to comment.