| 3294 | } |
| 3295 | |
| 3296 | func (db *datastore) InsertJob(j *PostJob) error { |
| 3297 | res, err := db.Exec("INSERT INTO publishjobs (post_id, action, delay) VALUES (?, ?, ?)", j.PostID, j.Action, j.Delay) |
| 3298 | if err != nil { |
| 3299 | return err |
| 3300 | } |
| 3301 | jobID, err := res.LastInsertId() |
| 3302 | if err != nil { |
| 3303 | log.Error("[jobs] Couldn't get last insert ID! %s", err) |
| 3304 | } |
| 3305 | log.Info("[jobs] Queued %s job #%d for post %s, delayed %d minutes", j.Action, jobID, j.PostID, j.Delay) |
| 3306 | return nil |
| 3307 | } |
| 3308 | |
| 3309 | func (db *datastore) UpdateJobForPost(postID string, delay int64) error { |
| 3310 | _, err := db.Exec("UPDATE publishjobs SET delay = ? WHERE post_id = ?", delay, postID) |