update job

This commit is contained in:
shoopea 2019-12-13 19:45:08 +08:00
parent cb5a0c1640
commit 415403c33e
2 changed files with 5 additions and 1 deletions

4
job.go
View File

@ -17,6 +17,10 @@ import (
) )
func createJob(jobTypeID int32, priority int32, userID64 int64, trigger int64, schedule time.Time, payload []byte) (int64, error) { func createJob(jobTypeID int32, priority int32, userID64 int64, trigger int64, schedule time.Time, payload []byte) (int64, error) {
if len(payload) > 20000 {
return 0, errors.New("payload too long")
}
stmt, err := db.Prepare(`INSERT INTO obj (obj_type_id, obj_sub_type_id) stmt, err := db.Prepare(`INSERT INTO obj (obj_type_id, obj_sub_type_id)
VALUES (? , ?);`) VALUES (? , ?);`)
logOnError(err, "createJob : prepare insert obj") logOnError(err, "createJob : prepare insert obj")

2
sql.go
View File

@ -383,7 +383,7 @@ func initDB() {
,started TIMESTAMP ,started TIMESTAMP
,ended TIMESTAMP ,ended TIMESTAMP
,timeout TIMESTAMP ,timeout TIMESTAMP
,payload VARCHAR(4000) ,payload VARCHAR(65532)
,FOREIGN KEY (obj_id) REFERENCES obj(id) ON DELETE CASCADE ,FOREIGN KEY (obj_id) REFERENCES obj(id) ON DELETE CASCADE
,KEY (is_done) ,KEY (is_done)
,KEY (in_work) ,KEY (in_work)