diff --git a/src/jobservice/api/handler.go b/src/jobservice/api/handler.go index dab2f12d4..ac3449270 100644 --- a/src/jobservice/api/handler.go +++ b/src/jobservice/api/handler.go @@ -216,7 +216,7 @@ func (dh *DefaultHandler) HandleJobLogReq(w http.ResponseWriter, req *http.Reque w.Write(logData) } -// HandleJobLogReq is implementation of method defined in interface 'Handler' +// HandlePeriodicExecutions is implementation of method defined in interface 'Handler' func (dh *DefaultHandler) HandlePeriodicExecutions(w http.ResponseWriter, req *http.Request) { // Get param vars := mux.Vars(req) diff --git a/src/jobservice/api/server.go b/src/jobservice/api/server.go index 4ad9dfad4..43ef54cf0 100644 --- a/src/jobservice/api/server.go +++ b/src/jobservice/api/server.go @@ -103,9 +103,9 @@ func (s *Server) Start() error { if s.config.Protocol == config.JobServiceProtocolHTTPS { return s.httpServer.ListenAndServeTLS(s.config.Cert, s.config.Key) - } else { - return s.httpServer.ListenAndServe() } + + return s.httpServer.ListenAndServe() } // Stop server gracefully. diff --git a/src/jobservice/common/query/q.go b/src/jobservice/common/query/q.go index d5d333dd1..38ec2c6fe 100644 --- a/src/jobservice/common/query/q.go +++ b/src/jobservice/common/query/q.go @@ -19,9 +19,9 @@ const ( DefaultPageSize uint = 25 // QueryParamKeyPage defines query param key of page number QueryParamKeyPage = "page_number" - // QueryParamKeyPage defines query param key of page size + // QueryParamKeyPageSize defines query param key of page size QueryParamKeyPageSize = "page_size" - // QueryParamKeyPage defines query param key of querying non stopped periodic executions + // QueryParamKeyNonStoppedOnly defines query param key of querying non stopped periodic executions QueryParamKeyNonStoppedOnly = "non_dead_only" // ExtraParamKeyNonStoppedOnly defines extra parameter key for querying non stopped periodic executions ExtraParamKeyNonStoppedOnly = "NonDeadOnly" diff --git a/src/jobservice/common/utils/utils.go b/src/jobservice/common/utils/utils.go index 757ec4372..54bbd7afd 100644 --- a/src/jobservice/common/utils/utils.go +++ b/src/jobservice/common/utils/utils.go @@ -29,13 +29,11 @@ import ( "strings" ) -// CtlContextKey is used to keep controller reference in the system context -type CtlContextKey string - // NodeIDContextKey is used to keep node ID in the system context type NodeIDContextKey string const ( + // NodeID is const of the ID context key NodeID NodeIDContextKey = "node_id" ) @@ -155,7 +153,7 @@ func DeSerializeJob(jobBytes []byte) (*work.Job, error) { return &j, err } -// Get the local hostname and IP +// ResolveHostnameAndIP gets the local hostname and IP func ResolveHostnameAndIP() (string, error) { host, err := os.Hostname() if err != nil { diff --git a/src/jobservice/job/context.go b/src/jobservice/job/context.go index 19e501882..3651e1817 100644 --- a/src/jobservice/job/context.go +++ b/src/jobservice/job/context.go @@ -70,5 +70,5 @@ type Context interface { Tracker() Tracker } -// JobContextInitializer is a func to initialize the concrete job context -type JobContextInitializer func(ctx context.Context) (Context, error) +// ContextInitializer is a func to initialize the concrete job context +type ContextInitializer func(ctx context.Context) (Context, error) diff --git a/src/jobservice/job/op_cmd.go b/src/jobservice/job/op_cmd.go index 5cb0ed713..3f1b24614 100644 --- a/src/jobservice/job/op_cmd.go +++ b/src/jobservice/job/op_cmd.go @@ -15,8 +15,10 @@ package job const ( + // StopCommand is const for stop command StopCommand OPCommand = "stop" - NilCommand OPCommand = "nil" + // NilCommand is const for a nil command + NilCommand OPCommand = "nil" ) // OPCommand is the type of job operation commands diff --git a/src/jobservice/runtime/bootstrap.go b/src/jobservice/runtime/bootstrap.go index ba8a4fef6..d66752882 100644 --- a/src/jobservice/runtime/bootstrap.go +++ b/src/jobservice/runtime/bootstrap.go @@ -53,11 +53,11 @@ var JobService = &Bootstrap{} // Bootstrap is coordinating process to help load and start the other components to serve. type Bootstrap struct { - jobConextInitializer job.JobContextInitializer + jobConextInitializer job.ContextInitializer } // SetJobContextInitializer set the job context initializer -func (bs *Bootstrap) SetJobContextInitializer(initializer job.JobContextInitializer) { +func (bs *Bootstrap) SetJobContextInitializer(initializer job.ContextInitializer) { if initializer != nil { bs.jobConextInitializer = initializer } diff --git a/src/jobservice/worker/cworker/de_duplicator.go b/src/jobservice/worker/cworker/de_duplicator.go index 9264367b0..db1829bca 100644 --- a/src/jobservice/worker/cworker/de_duplicator.go +++ b/src/jobservice/worker/cworker/de_duplicator.go @@ -13,7 +13,7 @@ import ( "github.com/gomodule/redigo/redis" ) -// redisDeDuplicator is designed to handle the uniqueness of the job. +// DeDuplicator is designed to handle the uniqueness of the job. // Once a job is declared to be unique, the job can be enqueued only if // no same job (same job name and parameters) in the queue or running in progress. // Adopt the same unique mechanism with the upstream framework. diff --git a/src/jobservice/worker/models.go b/src/jobservice/worker/models.go index 80c8fd3e1..428bf393d 100644 --- a/src/jobservice/worker/models.go +++ b/src/jobservice/worker/models.go @@ -14,12 +14,12 @@ package worker -// Info represents the healthy and status of all the running worker pools. +// Stats represents the healthy and status of all the running worker pools. type Stats struct { Pools []*StatsData `json:"worker_pools"` } -// JobPoolStatsData represent the healthy and status of the worker worker. +// StatsData represents the healthy and status of the worker worker. type StatsData struct { WorkerPoolID string `json:"worker_pool_id"` StartedAt int64 `json:"started_at"`