galihrivanto / runner

a simple wrapper for running operation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

a simple wrapper for running operation

License:MIT License


Languages

Language:Go 100.0%