Merge pull request #30 from mikespook/0.2-dev

SUBMIT_JOB_SCHED is deprecated, worker.Immediately should be removed.
This commit is contained in:
Xing 2014-01-15 17:52:24 -08:00
commit 7ea5fa7550
2 changed files with 6 additions and 11 deletions

View File

@ -37,13 +37,15 @@ Usage
## Worker ## Worker
w := worker.New(worker.Unlimited) // Limit number of concurrent jobs execution. Use worker.Unlimited (0) if you want no limitation.
w := worker.New(worker.OneByOne)
w.ErrHandler = func(e error) { w.ErrHandler = func(e error) {
log.Println(e) log.Println(e)
} }
w.AddServer("127.0.0.1:4730") w.AddServer("127.0.0.1:4730")
// this will give a timeout of 2 seconds. Use worker.Unlimited (0) if you want no timeout // Use worker.Unlimited (0) if you want no timeout
w.AddFunc("ToUpper", ToUpper, worker.Immediately) w.AddFunc("ToUpper", ToUpper, worker.Unlimited)
// This will give a timeout of 5 seconds
w.AddFunc("ToUpperTimeOut5", ToUpper, 5) w.AddFunc("ToUpperTimeOut5", ToUpper, 5)
if err := w.Ready(); err != nil { if err := w.Ready(); err != nil {
log.Fatal(err) log.Fatal(err)
@ -99,10 +101,5 @@ Contributors
Open Source - MIT Software License Open Source - MIT Software License
================================== ==================================
Copyright (c) 2012 Xing Xing
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: See LICENSE.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -12,8 +12,6 @@ import (
const ( const (
Unlimited = iota Unlimited = iota
OneByOne OneByOne
Immediately = iota
) )
// Worker is the only structure needed by worker side developing. // Worker is the only structure needed by worker side developing.