aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAlexander Kiryukhin <alexander@kiryukhin.su>2019-04-03 23:55:11 +0300
committerAlexander Kiryukhin <alexander@kiryukhin.su>2019-04-03 23:55:11 +0300
commit05212e50c9761181b1a2c0c9e8b43ae31fb24017 (patch)
treec25c9b189046d99a42d0b8bcc29422dc8d74d9cc /README.md
parent1772990500c97a79adce15c73919339d6e1618d7 (diff)
Added:
- Mixin with errors channel Changed: - Default run policy now `ShutdownIfDone` && `ShutdownIfFail` Fixed: - Fixed OS signals listener - Removed some dead code
Diffstat (limited to 'README.md')
-rwxr-xr-xREADME.md19
1 files changed, 15 insertions, 4 deletions
diff --git a/README.md b/README.md
index 060d797..6d922eb 100755
--- a/README.md
+++ b/README.md
@@ -49,7 +49,9 @@ Available options of run policy:
Default policy:
-`ShutdownIfFail` && `DoNothingIfDone`
+`ShutdownIfFail` && `ShutdownIfDone`
+
+(just like [errgroup](https://godoc.org/golang.org/x/sync/errgroup))
#### Example of run policies
@@ -100,11 +102,11 @@ r = r.With(mixin1, mixin2, ...) // Returns new instance of Rutina!
### Logger
```go
-r.With(rutina.WithStdLogger())
+r = r.With(rutina.WithStdLogger())
```
or
```go
-r.With(rutina.WithLogger(logger log.Logger))
+r = r.With(rutina.WithLogger(logger log.Logger))
```
Sets standard or custom logger. By default there is no logger.
@@ -112,11 +114,20 @@ Sets standard or custom logger. By default there is no logger.
### Custom context
```go
-r.With(rutina.WithContext(ctx context.Context))
+r = r.With(rutina.WithContext(ctx context.Context))
````
Propagates your own context to Rutina. By default it use own context.
+### Errors channel
+
+```go
+errChan := make(chan error)
+r = r.With(rutina.WithErrChan(errChan))
+```
+
+This channel will receive all errors from all routines with any `...Fail` run policy.
+
## Example
HTTP server with graceful shutdown [`example/http_server.go`](https://github.com/NeonXP/rutina/blob/master/example/http_server.go)