8000 GitHub - kakaLQY/jobber: Used for batch processing.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

kakaLQY/jobber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jobber

Used for batch processing.

##The situation Similar jobs can be handled together. Like can be used for batch methods from AWS SQS.

User can as simple as just add job to a place. Then a worker will take out the jobs in that place to handle. If there are two jobs, the worker will take out two. If there are three, the worker will take out three. But there may be a max number, like 10. If there are 20 jobs, the worker will take out 10 first, and start another loop.

##The features

  • Simple usage. User will define a worker function, then just add jobs.
  • Fast return. Because user just need to add jobs and no need to wait jobs done.
  • Single worker and it will be in a seperate goroutine.
  • Thread-safe.
  • Cache jobs in memory and retry the failed ones.

##Install & Update

go get -u github.com/LeeQY/jobber

##Usage

####Define the worker function:

func handleFunc(jobs []interface{}) bool {
	...
}

####Create a jobber

// pass in the function and max number.
jobber := New(handleFunc, 20)

####Just add job

jobber.AddJob(job)

About

Used for batch processing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0