Skip to content

Commit

Permalink
fix: unable to monitor data source status issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Jun 3, 2023
1 parent 68a112d commit 9c40ef4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions controllers/data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ func (ctr *dataSourceController) Post(c *gin.Context) {
HandleSuccess(c)
}

func (ctr *dataSourceController) Put(c *gin.Context) {
// data source
var _ds models.DataSource
if err := c.ShouldBindJSON(&_ds); err != nil {
HandleErrorBadRequest(c, err)
return
}

if err := delegate.NewModelDelegate(&_ds).Save(); err != nil {
HandleErrorInternalServerError(c, err)
return
}

// check data source status
go func() { _ = ctr.ctx.dsSvc.CheckStatus(_ds.Id) }()
}

type dataSourceContext struct {
dsSvc interfaces.DataSourceService
}
Expand Down
3 changes: 3 additions & 0 deletions ds/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ func NewDataSourceService(opts ...DataSourceServiceOption) (svc2 interfaces.Data
// initialize
svc.Init()

// start
svc.Start()

return svc, nil
}

Expand Down

0 comments on commit 9c40ef4

Please sign in to comment.