Skip to content
Snippets Groups Projects

V3

Open ale requested to merge v3 into master
3 files
+ 22
11
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 10
3
@@ -142,7 +142,13 @@ func popTask(tx *sql.Tx, now int64) (*Task, error) {
return t, err
}
func pushTask(tx *sql.Tx, t *Task) error {
func pushTask(tx *sql.Tx, t *Task, now time.Time) error {
// Sanity check to prevent errors where we never break out of
// the inner queue loop.
if !t.Deadline.After(now) {
panic("inserting task with deadline < now, potential deadlock!")
}
log.Printf("pushing transition %s", t.debugString())
_, err := tx.Exec(
"INSERT INTO tasks (id, op, deadline, failure_count, certificate, chain, private_key, not_after) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
@@ -164,13 +170,14 @@ func forceRenewal(tx *sql.Tx, hash uint64) error {
if err != nil {
return err
}
now := time.Now()
return pushTask(tx, &Task{
IntentCert: IntentCert{
Hash: hash,
},
Op: OpRenew,
Deadline: time.Now(),
})
Deadline: now,
}, now)
}
func cleanupOldTasks(tx *sql.Tx) error {
Loading