Skip to content

Commit

Permalink
fix: compiling issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Jul 12, 2024
1 parent d0611b4 commit 3a03ac6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 50 deletions.
3 changes: 2 additions & 1 deletion core/apps/api_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/crawlab-team/crawlab/core/controllers"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/middlewares"
"github.com/crawlab-team/crawlab/core/utils"
"github.com/gin-gonic/gin"
"github.com/spf13/viper"
"net"
Expand Down Expand Up @@ -73,7 +74,7 @@ func (app *ApiV2) Start() {
}

func (app *ApiV2) Wait() {
DefaultWait()
utils.DefaultWait()
}

func (app *ApiV2) Stop() {
Expand Down
40 changes: 40 additions & 0 deletions core/apps/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package apps

import (
"fmt"
"github.com/apex/log"
"github.com/crawlab-team/crawlab/core/utils"
"github.com/crawlab-team/crawlab/trace"
)

func Start(app App) {
start(app)
}

func start(app App) {
app.Init()
go app.Start()
app.Wait()
app.Stop()
}

func DefaultWait() {
utils.DefaultWait()
}

func initModule(name string, fn func() error) (err error) {
if err := fn(); err != nil {
log.Error(fmt.Sprintf("init %s error: %s", name, err.Error()))
_ = trace.TraceError(err)
panic(err)
}
log.Info(fmt.Sprintf("initialized %s successfully", name))
return nil
}

func initApp(name string, app App) {
_ = initModule(name, func() error {
app.Init()
return nil
})
}
43 changes: 0 additions & 43 deletions core/grpc/server/options.go

This file was deleted.

6 changes: 0 additions & 6 deletions core/node/service/master_service_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,6 @@ func newMasterServiceV2() (res *MasterServiceV2, err error) {
stopOnError: false,
}

// server options
var serverOpts []server.Option
if svc.address != nil {
serverOpts = append(serverOpts, server.WithAddress(svc.address))
}

// node config service
svc.cfgSvc = config.GetNodeConfigService()

Expand Down

0 comments on commit 3a03ac6

Please sign in to comment.