Change Server API

* Rename ServerStatus to ServerState internally

* Rename terminate to shutdown internally

* Update Scheduler API to match Server API
This commit is contained in:
Ken Hibino
2021-03-23 06:20:54 -07:00
parent 476812475e
commit 9c95c41651
26 changed files with 175 additions and 169 deletions

View File

@@ -30,7 +30,7 @@ func ExampleServer_Run() {
}
}
func ExampleServer_Stop() {
func ExampleServer_Shutdown() {
srv := asynq.NewServer(
asynq.RedisClientOpt{Addr: ":6379"},
asynq.Config{Concurrency: 20},
@@ -47,10 +47,10 @@ func ExampleServer_Stop() {
signal.Notify(sigs, unix.SIGTERM, unix.SIGINT)
<-sigs // wait for termination signal
srv.Stop()
srv.Shutdown()
}
func ExampleServer_Quiet() {
func ExampleServer_Stop() {
srv := asynq.NewServer(
asynq.RedisClientOpt{Addr: ":6379"},
asynq.Config{Concurrency: 20},
@@ -70,13 +70,13 @@ func ExampleServer_Quiet() {
for {
s := <-sigs
if s == unix.SIGTSTP {
srv.Quiet() // stop processing new tasks
srv.Stop() // stop processing new tasks
continue
}
break
break // received SIGTERM or SIGINT signal
}
srv.Stop()
srv.Shutdown()
}
func ExampleScheduler() {