Cleanup jobschedule channel passing
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"git.ohea.xyz/cursorius/server/jobscheduler"
|
||||
apiv1 "git.ohea.xyz/cursorius/server/proto/gen/api/v1"
|
||||
"git.ohea.xyz/cursorius/server/proto/gen/api/v1/apiv1connect"
|
||||
"github.com/bufbuild/connect-go"
|
||||
@@ -12,7 +13,9 @@ import (
|
||||
|
||||
var log = logging.MustGetLogger("cursorius-server")
|
||||
|
||||
type ApiServer struct{}
|
||||
type ApiServer struct {
|
||||
runCh chan jobscheduler.Run
|
||||
}
|
||||
|
||||
func (s *ApiServer) GetRunner(
|
||||
ctx context.Context,
|
||||
@@ -40,8 +43,8 @@ func (s *ApiServer) RunCommand(
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func CreateHandler(mux *http.ServeMux) {
|
||||
api_server := &ApiServer{}
|
||||
func CreateHandler(mux *http.ServeMux, runCh chan jobscheduler.Run) {
|
||||
api_server := &ApiServer{runCh: runCh}
|
||||
path, handler := apiv1connect.NewGetRunnerServiceHandler(api_server)
|
||||
mux.Handle(path, handler)
|
||||
path, handler = apiv1connect.NewRunCommandServiceHandler(api_server)
|
||||
|
||||
Reference in New Issue
Block a user