- add task_issue_record

- add task_receive_record
master
李光春 2 years ago
parent 5014f8a92a
commit a20d2b6d80

@ -109,6 +109,8 @@ func NewClient(config *ClientConfig) (*Client, error) {
c.mongoCreateIndexesTaskLog(ctx)
c.mongoCreateCollectionTaskLogRun(ctx)
c.mongoCreateIndexesTaskLogRun(ctx)
c.mongoCreateCollectionTaskIssueRecord(ctx)
c.mongoCreateCollectionTaskReceiveRecord(ctx)
}
redisClient := config.RedisClientFun()

@ -9,7 +9,7 @@ require (
go.dtapp.net/dorm v1.0.30
go.dtapp.net/goarray v1.0.1
go.dtapp.net/goip v1.0.28
go.dtapp.net/golog v1.0.54
go.dtapp.net/golog v1.0.55
go.dtapp.net/gostring v1.0.10
go.dtapp.net/gotime v1.0.5
go.dtapp.net/gotrace_id v1.0.6
@ -55,13 +55,14 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/saracen/go7z v0.0.0-20191010121135-9c09b6bd7fda // indirect
github.com/saracen/solidblock v0.0.0-20190426153529-45df20abab6f // indirect
github.com/segmentio/fasthash v1.0.3 // indirect
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/upper/db/v4 v4.5.4 // indirect
github.com/upper/db/v4 v4.6.0 // indirect
github.com/uptrace/bun v1.1.8 // indirect
github.com/uptrace/bun/dialect/mysqldialect v1.1.8 // indirect
github.com/uptrace/bun/dialect/pgdialect v1.1.8 // indirect

@ -335,6 +335,7 @@ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceT
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
@ -437,6 +438,8 @@ github.com/saracen/solidblock v0.0.0-20190426153529-45df20abab6f h1:1cJITU3JUI8q
github.com/saracen/solidblock v0.0.0-20190426153529-45df20abab6f/go.mod h1:LyBTue+RWeyIfN3ZJ4wVxvDuvlGJtDgCLgCb6HCPgps=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/segmentio/fasthash v1.0.3 h1:EI9+KE1EwvMLBWwjpRDc+fEM+prwxDYbslddQGtrmhM=
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 h1:DAYUYH5869yV94zvCES9F51oYtN5oGlwjxJJz7ZCnik=
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
@ -484,8 +487,8 @@ github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/upper/db/v4 v4.5.4 h1:Hxho4jSx4E+3fxlFgdH4wQTRKygtL0YQPDLQPCUu9wg=
github.com/upper/db/v4 v4.5.4/go.mod h1:wyu5BM5Y2gowOt4i6C4LbxftH9QeUF338XVGH4uk+Eo=
github.com/upper/db/v4 v4.6.0 h1:0VmASnqrl/XN8Ehoq++HBgZ4zRD5j3GXygW8FhP0C5I=
github.com/upper/db/v4 v4.6.0/go.mod h1:2mnRcPf+RcCXmVcD+o04LYlyu3UuF7ubamJia7CkN6s=
github.com/uptrace/bun v1.1.8 h1:slxuaP4LYWFbPRUmTtQhfJN+6eX/6ar2HDKYTcI50SA=
github.com/uptrace/bun v1.1.8/go.mod h1:iT89ESdV3uMupD9ixt6Khidht+BK0STabK/LeZE+B84=
github.com/uptrace/bun/dialect/mysqldialect v1.1.8 h1:gcL5iy0yUbuJJLkE+0G3vAUS/6GjPLkqFTtN2+tx7XU=
@ -519,8 +522,8 @@ go.dtapp.net/goarray v1.0.1 h1:cHNHaJ2MFcuJPA1WKU2PM1EUZShS1vQqEH7n6YXsQVU=
go.dtapp.net/goarray v1.0.1/go.mod h1:/MPhlFCAhQyeNV1M0v1PAOOX33Sg705fVjUgMO12IBQ=
go.dtapp.net/goip v1.0.28 h1:wZt+wbzNhOLRUJnepG4c8HhUr4V9jNXOF6wJ1h7jUvU=
go.dtapp.net/goip v1.0.28/go.mod h1:ZqPPUvpOSzdtB/dEZFiaD0CBRZmvIzjDmm3XkpMC9Bo=
go.dtapp.net/golog v1.0.54 h1:G8AQYYEUn54mo4jRhp3z/ytxhzLPFq+6ZFJZX2Yo7cg=
go.dtapp.net/golog v1.0.54/go.mod h1:5xs4w/9Aq1gfuauj2KCRGegCjaiyHmiJ3Deb3xy8tDY=
go.dtapp.net/golog v1.0.55 h1:GSxajhpLbssXF4kRlGVArLBMjTCqunttLVipfmkBWbo=
go.dtapp.net/golog v1.0.55/go.mod h1:5xs4w/9Aq1gfuauj2KCRGegCjaiyHmiJ3Deb3xy8tDY=
go.dtapp.net/gorandom v1.0.1 h1:IWfMClh1ECPvyUjlqD7MwLq4mZdUusD1qAwAdsvEJBs=
go.dtapp.net/gorandom v1.0.1/go.mod h1:ZPdgalKpvFV/ATQqR0k4ns/F/IpITAZpx6WkWirr5Y8=
go.dtapp.net/gorequest v1.0.28 h1:EehFtF5WcvyZ9rB6MAQoI2kJkhR8Wv8tVgpoxXcb3sI=

@ -0,0 +1,52 @@
package jobs_mongo_model
import (
"go.dtapp.net/dorm"
"go.mongodb.org/mongo-driver/bson/primitive"
)
type TaskIssueRecordTaskInfo struct {
Id uint `json:"id,omitempty" bson:"id,omitempty"` // 记录编号
Status string `json:"status,omitempty" bson:"status,omitempty"` // 状态码
Params string `json:"params,omitempty" bson:"params,omitempty"` // 参数
ParamsType string `json:"params_type,omitempty" bson:"params_type,omitempty"` // 参数类型
StatusDesc string `json:"status_desc,omitempty" bson:"status_desc,omitempty"` // 状态描述
Frequency int64 `json:"frequency,omitempty" bson:"frequency,omitempty"` // 频率(秒单位)
Number int64 `json:"number,omitempty" bson:"number,omitempty"` // 当前次数
MaxNumber int64 `json:"max_number,omitempty" bson:"max_number,omitempty"` // 最大次数
RunId string `json:"run_id,omitempty" bson:"run_id,omitempty"` // 执行编号
CustomId string `json:"custom_id,omitempty" bson:"custom_id,omitempty"` // 自定义编号
CustomSequence int64 `json:"custom_sequence,omitempty" bson:"custom_sequence,omitempty"` // 自定义顺序
Type string `json:"type,omitempty" bson:"type,omitempty"` // 类型
TypeName string `json:"type_name,omitempty" bson:"type_name,omitempty"` // 类型名称
CreatedIp string `json:"created_ip,omitempty" bson:"created_ip,omitempty"` // 创建外网IP
SpecifyIp string `json:"specify_ip,omitempty" bson:"specify_ip,omitempty"` // 指定外网IP
UpdatedIp string `json:"updated_ip,omitempty" bson:"updated_ip,omitempty"` // 更新外网IP
Result string `json:"result,omitempty" bson:"result,omitempty"` // 结果
NextRunTime dorm.BsonTime `json:"next_run_time,omitempty" bson:"next_run_time,omitempty"` // 下次运行时间
CreatedAt dorm.BsonTime `json:"created_at,omitempty" bson:"created_at,omitempty"` // 创建时间
UpdatedAt dorm.BsonTime `json:"updated_at,omitempty" bson:"updated_at,omitempty"` // 更新时间
}
type TaskIssueRecordSystemInfo struct {
OutsideIp string `json:"outside_ip,omitempty" bson:"outside_ip,omitempty"` // 外网ip
InsideIp string `json:"inside_ip,omitempty" bson:"inside_ip,omitempty"` // 内网ip
Os string `json:"os,omitempty" bson:"os,omitempty"` // 系统类型
Arch string `json:"arch,omitempty" bson:"arch,omitempty"` // 系统架构
Gomaxprocs int `json:"gomaxprocs,omitempty" bson:"gomaxprocs,omitempty"` // CPU核数
GoVersion string `json:"go_version,omitempty" bson:"go_version,omitempty"` // GO版本
SdkVersion string `json:"sdk_version,omitempty" bson:"sdk_version,omitempty"` // SDK版本
}
// TaskIssueRecord 任务发布记录
type TaskIssueRecord struct {
Id primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"` // 记录编号
TaskInfo TaskIssueRecordTaskInfo `json:"task_info,omitempty" bson:"task_info,omitempty"` // 任务信息
SystemInfo TaskIssueRecordSystemInfo `json:"system_info,omitempty" bson:"system_info,omitempty"` // 系统信息
RecordAddress string `json:"record_address,omitempty" bson:"record_address,omitempty"` // 接收地址
RecordTime dorm.BsonTime `json:"record_time,omitempty" bson:"record_time,omitempty"` // 记录时间
}
func (TaskIssueRecord) TableName() string {
return "task_issue_record"
}

@ -0,0 +1,18 @@
package jobs_mongo_model
import (
"go.dtapp.net/dorm"
"go.mongodb.org/mongo-driver/bson/primitive"
)
// TaskReceiveRecord 任务接收记录
type TaskReceiveRecord struct {
Id primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"` // 记录编号
TaskInfo TaskIssueRecordTaskInfo `json:"task_info,omitempty" bson:"task_info,omitempty"` // 任务信息
SystemInfo TaskIssueRecordSystemInfo `json:"system_info,omitempty" bson:"system_info,omitempty"` // 系统信息
RecordTime dorm.BsonTime `json:"record_time,omitempty" bson:"record_time,omitempty"` // 记录时间
}
func (TaskReceiveRecord) TableName() string {
return "task_receive_record_"
}

@ -137,3 +137,31 @@ func (c *Client) mongoCreateIndexesTaskLogRun(ctx context.Context) {
{"go_version", -1},
}}))
}
// 创建时间序列集合
func (c *Client) mongoCreateCollectionTaskIssueRecord(ctx context.Context) {
var commandResult bson.M
commandErr := c.db.mongoClient.Db.Database(c.db.mongoDatabaseName).RunCommand(ctx, bson.D{{
"listCollections", 1,
}}).Decode(&commandResult)
if commandErr != nil {
c.zapLog.WithTraceId(ctx).Sugar().Errorf("检查时间序列集合:%s", commandErr)
} else {
c.zapLog.WithTraceId(ctx).Sugar().Info(c.db.mongoClient.Db.Database(c.db.mongoDatabaseName).CreateCollection(ctx, jobs_mongo_model.TaskIssueRecord{}.TableName(), options.CreateCollection().SetTimeSeriesOptions(options.TimeSeries().SetTimeField("record_time"))))
}
}
// 创建时间序列集合
func (c *Client) mongoCreateCollectionTaskReceiveRecord(ctx context.Context) {
if c.cache.cornKeyCustom != "" {
var commandResult bson.M
commandErr := c.db.mongoClient.Db.Database(c.db.mongoDatabaseName).RunCommand(ctx, bson.D{{
"listCollections", 1,
}}).Decode(&commandResult)
if commandErr != nil {
c.zapLog.WithTraceId(ctx).Sugar().Errorf("检查时间序列集合:%s", commandErr)
} else {
c.zapLog.WithTraceId(ctx).Sugar().Info(c.db.mongoClient.Db.Database(c.db.mongoDatabaseName).CreateCollection(ctx, jobs_mongo_model.TaskReceiveRecord{}.TableName()+c.cache.cornKeyCustom, options.CreateCollection().SetTimeSeriesOptions(options.TimeSeries().SetTimeField("record_time"))))
}
}
}

@ -0,0 +1,55 @@
package gojobs
import (
"context"
"go.dtapp.net/dorm"
"go.dtapp.net/gojobs/jobs_gorm_model"
"go.dtapp.net/gojobs/jobs_mongo_model"
"go.dtapp.net/gotime"
"go.mongodb.org/mongo-driver/bson/primitive"
)
// PublishLog 发布记录
func (c *Client) PublishLog(ctx context.Context, info jobs_gorm_model.Task, recordAddress string) {
_, err := c.db.mongoClient.Database(c.db.mongoDatabaseName).
Collection(jobs_mongo_model.TaskIssueRecord{}.TableName()).
InsertOne(&jobs_mongo_model.TaskIssueRecord{
Id: primitive.NewObjectID(),
TaskInfo: jobs_mongo_model.TaskIssueRecordTaskInfo{
Id: info.Id,
Status: info.Status,
Params: info.Params,
ParamsType: info.ParamsType,
StatusDesc: info.StatusDesc,
Frequency: info.Frequency,
Number: info.Number,
MaxNumber: info.MaxNumber,
RunId: info.RunId,
CustomId: info.CustomId,
CustomSequence: info.CustomSequence,
Type: info.Type,
TypeName: info.TypeName,
CreatedIp: info.CreatedIp,
SpecifyIp: info.SpecifyIp,
UpdatedIp: info.UpdatedIp,
Result: info.Result,
NextRunTime: dorm.BsonTime(info.NextRunTime),
CreatedAt: dorm.BsonTime(info.CreatedAt),
UpdatedAt: dorm.BsonTime(info.UpdatedAt),
},
SystemInfo: jobs_mongo_model.TaskIssueRecordSystemInfo{
InsideIp: c.config.insideIp,
OutsideIp: c.config.outsideIp,
Os: c.config.os,
Arch: c.config.arch,
Gomaxprocs: c.config.maxProCs,
GoVersion: c.config.version,
SdkVersion: c.config.runVersion,
},
RecordAddress: recordAddress,
RecordTime: dorm.BsonTime(gotime.Current().Time),
})
if err != nil {
c.zapLog.WithTraceId(ctx).Sugar().Errorf("[gojobs.RunAddLog.jobs_mongo_model.TaskIssueRecord]%s", err.Error())
}
}

117
run.go

@ -1,6 +1,8 @@
package gojobs
import (
"context"
"go.dtapp.net/dorm"
"go.dtapp.net/gojobs/jobs_gorm_model"
"go.dtapp.net/gojobs/jobs_mongo_model"
"go.dtapp.net/gostring"
@ -9,7 +11,52 @@ import (
)
// Run 运行
func (c *Client) Run(info jobs_gorm_model.Task, status int, result string) {
func (c *Client) Run(ctx context.Context, info jobs_gorm_model.Task, status int, result string) {
// 任务接收记录
go func() {
if c.cache.cornKeyCustom != "" {
_, err := c.db.mongoClient.Database(c.db.mongoDatabaseName).
Collection(jobs_mongo_model.TaskReceiveRecord{}.TableName() + c.cache.cornKeyCustom).
InsertOne(&jobs_mongo_model.TaskReceiveRecord{
Id: primitive.NewObjectID(),
TaskInfo: jobs_mongo_model.TaskIssueRecordTaskInfo{
Id: info.Id,
Status: info.Status,
Params: info.Params,
ParamsType: info.ParamsType,
StatusDesc: info.StatusDesc,
Frequency: info.Frequency,
Number: info.Number,
MaxNumber: info.MaxNumber,
RunId: info.RunId,
CustomId: info.CustomId,
CustomSequence: info.CustomSequence,
Type: info.Type,
TypeName: info.TypeName,
CreatedIp: info.CreatedIp,
SpecifyIp: info.SpecifyIp,
UpdatedIp: info.UpdatedIp,
Result: info.Result,
NextRunTime: dorm.BsonTime(info.NextRunTime),
CreatedAt: dorm.BsonTime(info.CreatedAt),
UpdatedAt: dorm.BsonTime(info.UpdatedAt),
},
SystemInfo: jobs_mongo_model.TaskIssueRecordSystemInfo{
InsideIp: c.config.insideIp,
OutsideIp: c.config.outsideIp,
Os: c.config.os,
Arch: c.config.arch,
Gomaxprocs: c.config.maxProCs,
GoVersion: c.config.version,
SdkVersion: c.config.runVersion,
},
RecordTime: dorm.BsonTime(gotime.Current().Time),
})
if err != nil {
c.zapLog.WithTraceId(ctx).Sugar().Errorf("[gojobs.Run.jobs_mongo_model.TaskReceiveRecord]%s", err.Error())
}
}
}()
// 请求函数记录
err := c.db.gormClient.Db.Create(&jobs_gorm_model.TaskLog{
TaskId: info.Id,
@ -18,19 +65,24 @@ func (c *Client) Run(info jobs_gorm_model.Task, status int, result string) {
Version: c.config.runVersion,
}).Error
if err != nil {
c.zapLog.WithLogger().Sugar().Errorf("[gojobs.Run.Create]%s", err.Error())
c.zapLog.WithTraceId(ctx).Sugar().Errorf("[gojobs.Run.Create]%s", err.Error())
}
// 记录
if c.db.mongoClient != nil && c.db.mongoClient.Db != nil {
go func() {
c.db.mongoClient.Database(c.db.mongoDatabaseName).Collection(jobs_mongo_model.TaskLog{}.TableName()).InsertOne(&jobs_mongo_model.TaskLog{
Id: primitive.NewObjectID(),
TaskId: info.Id,
StatusCode: status,
Desc: result,
Version: c.config.runVersion,
CreatedAt: primitive.NewDateTimeFromTime(gotime.Current().Time),
})
_, err = c.db.mongoClient.Database(c.db.mongoDatabaseName).
Collection(jobs_mongo_model.TaskLog{}.TableName()).
InsertOne(&jobs_mongo_model.TaskLog{
Id: primitive.NewObjectID(),
TaskId: info.Id,
StatusCode: status,
Desc: result,
Version: c.config.runVersion,
CreatedAt: primitive.NewDateTimeFromTime(gotime.Current().Time),
})
if err != nil {
c.zapLog.WithTraceId(ctx).Sugar().Errorf("[gojobs.Run.jobs_mongo_model.TaskLog]%s", err.Error())
}
}()
}
if status == 0 {
@ -42,7 +94,7 @@ func (c *Client) Run(info jobs_gorm_model.Task, status int, result string) {
NextRunTime: gotime.Current().AfterSeconds(info.Frequency).Time,
}).Error
if err != nil {
c.zapLog.WithLogger().Sugar().Errorf("[gojobs.Run.0.EditTask]%s", err.Error())
c.zapLog.WithTraceId(ctx).Sugar().Errorf("[gojobs.Run.0.EditTask]%s", err.Error())
}
return
}
@ -60,7 +112,7 @@ func (c *Client) Run(info jobs_gorm_model.Task, status int, result string) {
NextRunTime: gotime.Current().AfterSeconds(info.Frequency).Time,
}).Error
if err != nil {
c.zapLog.WithLogger().Sugar().Errorf("[gojobs.Run.CodeSuccess.EditTask]%s", err.Error())
c.zapLog.WithTraceId(ctx).Sugar().Errorf("[gojobs.Run.CodeSuccess.EditTask]%s", err.Error())
}
}
if status == CodeEnd {
@ -76,7 +128,7 @@ func (c *Client) Run(info jobs_gorm_model.Task, status int, result string) {
NextRunTime: gotime.Current().Time,
}).Error
if err != nil {
c.zapLog.WithLogger().Sugar().Errorf("[gojobs.Run.CodeEnd.EditTask]%s", err.Error())
c.zapLog.WithTraceId(ctx).Sugar().Errorf("[gojobs.Run.CodeEnd.EditTask]%s", err.Error())
}
}
if status == CodeError {
@ -92,7 +144,7 @@ func (c *Client) Run(info jobs_gorm_model.Task, status int, result string) {
NextRunTime: gotime.Current().AfterSeconds(info.Frequency).Time,
}).Error
if err != nil {
c.zapLog.WithLogger().Sugar().Errorf("[gojobs.Run.CodeError.EditTask]%s", err.Error())
c.zapLog.WithTraceId(ctx).Sugar().Errorf("[gojobs.Run.CodeError.EditTask]%s", err.Error())
}
}
if info.MaxNumber != 0 {
@ -104,30 +156,35 @@ func (c *Client) Run(info jobs_gorm_model.Task, status int, result string) {
Status: TASK_TIMEOUT,
}).Error
if err != nil {
c.zapLog.WithLogger().Sugar().Errorf("[gojobs.Run.TASK_TIMEOUT.EditTask]%s", err.Error())
c.zapLog.WithTraceId(ctx).Sugar().Errorf("[gojobs.Run.TASK_TIMEOUT.EditTask]%s", err.Error())
}
}
}
}
// RunAddLog 任务执行日志
func (c *Client) RunAddLog(id uint, runId string) error {
func (c *Client) RunAddLog(ctx context.Context, id uint, runId string) error {
if c.db.mongoClient != nil && c.db.mongoClient.Db != nil {
go func() {
c.db.mongoClient.Database(c.db.mongoDatabaseName).Collection(jobs_mongo_model.TaskLogRun{}.TableName()).InsertOne(&jobs_mongo_model.TaskLogRun{
Id: primitive.NewObjectID(),
TaskId: id,
RunId: runId,
InsideIp: c.config.insideIp,
OutsideIp: c.config.outsideIp,
Os: c.config.os,
Arch: c.config.arch,
Gomaxprocs: c.config.maxProCs,
GoVersion: c.config.version,
SdkVersion: c.config.runVersion,
MacAddrs: c.config.macAddrS,
CreatedAt: primitive.NewDateTimeFromTime(gotime.Current().Time),
})
_, err := c.db.mongoClient.Database(c.db.mongoDatabaseName).
Collection(jobs_mongo_model.TaskLogRun{}.TableName()).
InsertOne(&jobs_mongo_model.TaskLogRun{
Id: primitive.NewObjectID(),
TaskId: id,
RunId: runId,
InsideIp: c.config.insideIp,
OutsideIp: c.config.outsideIp,
Os: c.config.os,
Arch: c.config.arch,
Gomaxprocs: c.config.maxProCs,
GoVersion: c.config.version,
SdkVersion: c.config.runVersion,
MacAddrs: c.config.macAddrS,
CreatedAt: primitive.NewDateTimeFromTime(gotime.Current().Time),
})
if err != nil {
c.zapLog.WithTraceId(ctx).Sugar().Errorf("[gojobs.RunAddLog.jobs_mongo_model.TaskLogRun]%s", err.Error())
}
}()
}
return c.db.gormClient.Db.Create(&jobs_gorm_model.TaskLogRun{

Loading…
Cancel
Save