Skip to content

galihrivanto/runner

Repository files navigation

runner

go.dev reference

Runner provides simple wrapper for operation which may fails, thus can be retried. It handle common OS signals which indicate program being interupted, closed etc.

simple usage:

ctx, cancel := context.WithCancel(context.Background())

runner.RunWithRetry(func(mctx context.Context) error {
    ...
})
.Handle(func(sig os.Signal){
    cancel()
})

license

MIT