Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Alphaterra/artifex
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Borders committed Nov 1, 2018
2 parents b8d66a0 + eb7fd8c commit 96c1e28
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
15 changes: 14 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
language: go
language: go

go:
- 1.11.x
- tip

before_install:
- go get -t -v ./...

script:
- go test -coverprofile=coverage.txt -covermode=atomic

after_success:
- bash <(curl -s https://codecov.io/bash)
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
[![GoDoc](http://godoc.org/github.com/mborders/job-queue?status.png)](http://godoc.org/github.com/mborders/job-queue)
[![Build Status](https://travis-ci.org/mborders/job-queue.svg?branch=master)](https://travis-ci.org/mborders/job-queue)
[![Go Report Card](https://goreportcard.com/badge/github.com/mborders/job-queue)](https://goreportcard.com/report/github.com/mborders/job-queue)
[![GoDoc](http://godoc.org/github.com/alphaterra/artifex?status.png)](http://godoc.org/github.com/alphaterra/artifex)
[![Build Status](https://travis-ci.org/alphaterra/artifex.svg?branch=master)](https://travis-ci.org/alphaterra/artifex)
[![Go Report Card](https://goreportcard.com/badge/github.com/alphaterra/artifex)](https://goreportcard.com/report/github.com/alphaterra/artifex)
[![codecov](https://codecov.io/gh/alphaterra/artifex/branch/master/graph/badge.svg)](https://codecov.io/gh/alphaterra/artifex)

# artifex

Simple in-memory job queue for Golang using worker-based dispatching

Documentation here: https://godoc.org/github.com/mborders/job-queue
Documentation here: https://godoc.org/github.com/alphaterra/artifex

## Example Usage

```go
// 10 workers, 100 max in job queue
d := artifex.NewDispatcher(10, 100)
d.Run()

d.Dispatch(artifex.Job{Run: func() {
// do something
}})

err := d.DispatchIn(artifex.Job{Run: func() {
// do something in 500ms
}}, time.Millisecond*500)

// Returns a DispatchTicker
dt, err := d.DispatchEvery(artifex.Job{Run: func() {
// do something every 250ms
}}, time.Millisecond*250)

// Stop a given DispatchTicker
dt.Stop()

// Stop a dispatcher and all its workers
d.Stop()
```

0 comments on commit 96c1e28

Please sign in to comment.