Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit 9c40ef4

Browse files
committed
fix: unable to monitor data source status issue
1 parent 68a112d commit 9c40ef4

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

controllers/data_source.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@ func (ctr *dataSourceController) Post(c *gin.Context) {
6969
HandleSuccess(c)
7070
}
7171

72+
func (ctr *dataSourceController) Put(c *gin.Context) {
73+
// data source
74+
var _ds models.DataSource
75+
if err := c.ShouldBindJSON(&_ds); err != nil {
76+
HandleErrorBadRequest(c, err)
77+
return
78+
}
79+
80+
if err := delegate.NewModelDelegate(&_ds).Save(); err != nil {
81+
HandleErrorInternalServerError(c, err)
82+
return
83+
}
84+
85+
// check data source status
86+
go func() { _ = ctr.ctx.dsSvc.CheckStatus(_ds.Id) }()
87+
}
88+
7289
type dataSourceContext struct {
7390
dsSvc interfaces.DataSourceService
7491
}

ds/service.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ func NewDataSourceService(opts ...DataSourceServiceOption) (svc2 interfaces.Data
288288
// initialize
289289
svc.Init()
290290

291+
// start
292+
svc.Start()
293+
291294
return svc, nil
292295
}
293296

0 commit comments

Comments
 (0)