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

@@ -40,8 +40,8 @@ type heartbeater struct {
started time.Time
workers map[string]*workerInfo
// status is shared with other goroutine but is concurrency safe.
status *base.ServerStatus
// state is shared with other goroutine but is concurrency safe.
state *base.ServerState
// channels to receive updates on active workers.
starting <-chan *workerInfo
@@ -55,7 +55,7 @@ type heartbeaterParams struct {
concurrency int
queues map[string]int
strictPriority bool
status *base.ServerStatus
state *base.ServerState
starting <-chan *workerInfo
finished <-chan *base.TaskMessage
}
@@ -79,14 +79,14 @@ func newHeartbeater(params heartbeaterParams) *heartbeater {
queues: params.queues,
strictPriority: params.strictPriority,
status: params.status,
state: params.state,
workers: make(map[string]*workerInfo),
starting: params.starting,
finished: params.finished,
}
}
func (h *heartbeater) terminate() {
func (h *heartbeater) shutdown() {
h.logger.Debug("Heartbeater shutting down...")
// Signal the heartbeater goroutine to stop.
h.done <- struct{}{}
@@ -142,7 +142,7 @@ func (h *heartbeater) beat() {
Concurrency: h.concurrency,
Queues: h.queues,
StrictPriority: h.strictPriority,
Status: h.status.String(),
Status: h.state.String(),
Started: h.started,
ActiveWorkerCount: len(h.workers),
}