mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-02-01 18:20:17 +01:00
feat: updated dependency handler logic
This commit is contained in:
@@ -30,13 +30,10 @@ func (svr DependencyServiceServer) Connect(req *grpc.DependencyServiceConnectReq
|
||||
log.Info("[DependencyServiceServer] connected: " + req.NodeKey)
|
||||
|
||||
// Keep this scope alive because once this scope exits - the stream is closed
|
||||
for {
|
||||
select {
|
||||
case <-stream.Context().Done():
|
||||
log.Info("[DependencyServiceServer] disconnected: " + req.NodeKey)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
<-stream.Context().Done()
|
||||
log.Info("[DependencyServiceServer] disconnected: " + req.NodeKey)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (svr DependencyServiceServer) Sync(ctx context.Context, request *grpc.DependencyServiceSyncRequest) (response *grpc.Response, err error) {
|
||||
|
||||
@@ -74,7 +74,6 @@ func GetModelInstances() []any {
|
||||
*new(Dependency),
|
||||
*new(DependencyLog),
|
||||
*new(DependencySetting),
|
||||
*new(DependencyTask),
|
||||
*new(DependencyRepo),
|
||||
*new(Environment),
|
||||
*new(Git),
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package models
|
||||
|
||||
import "go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
type DependencyLog struct {
|
||||
any `collection:"dependency_logs"`
|
||||
BaseModel[DependencyLog] `bson:",inline"`
|
||||
TaskId primitive.ObjectID `json:"task_id" bson:"task_id"`
|
||||
Content string `json:"content" bson:"content"`
|
||||
Content string `json:"content" bson:"content"`
|
||||
}
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type DependencySetting struct {
|
||||
any `collection:"dependency_settings"`
|
||||
BaseModel[DependencySetting] `bson:",inline"`
|
||||
Key string `json:"key" bson:"key"`
|
||||
Name string `json:"name" bson:"name"`
|
||||
Description string `json:"description" bson:"description"`
|
||||
Enabled bool `json:"enabled" bson:"enabled"`
|
||||
Cmd string `json:"cmd" bson:"cmd"`
|
||||
Proxy string `json:"proxy" bson:"proxy"`
|
||||
LastUpdateTs time.Time `json:"last_update_ts" bson:"last_update_ts"`
|
||||
Key string `json:"key" bson:"key"`
|
||||
Name string `json:"name" bson:"name"`
|
||||
Description string `json:"description" bson:"description"`
|
||||
Enabled bool `json:"enabled" bson:"enabled"`
|
||||
Cmd string `json:"cmd" bson:"cmd"`
|
||||
Proxy string `json:"proxy" bson:"proxy"`
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package models
|
||||
|
||||
import "go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
type DependencyTask struct {
|
||||
any `collection:"dependency_tasks"`
|
||||
BaseModel[DependencyTask] `bson:",inline"`
|
||||
Status string `json:"status" bson:"status"`
|
||||
Error string `json:"error" bson:"error"`
|
||||
SettingId primitive.ObjectID `json:"setting_id" bson:"setting_id"`
|
||||
Type string `json:"type" bson:"type"`
|
||||
NodeId primitive.ObjectID `json:"node_id" bson:"node_id"`
|
||||
Action string `json:"action" bson:"action"`
|
||||
DepNames []string `json:"dep_names" bson:"dep_names"`
|
||||
}
|
||||
Reference in New Issue
Block a user