func (q *queue) Recover() error {
	wb := new(leveldb.Batch)

	prefix := bytes.Join([][]byte{activePrefix, []byte{}}, queueKeySep)
	iter := q.db.NewPrefixIterator(prefix)
	defer iter.Release()
	for iter.Next() {
		var p queuePair
		if err := iter.Value(&p); err != nil {
			continue
		}
		p.key = iter.Key()[len(activePrefix)+1:]
		if err := q.db.PutObjBatch(wb, p.key, &p); err != nil {
			return err
		}
		wb.Delete(iter.Key())
	}

	return q.db.Write(wb, nil)
}
// Recover moves all active tasks to the pending queue. To be
// called at startup to recover tasks that were active when the
// previous run terminated.
Recover moves all active tasks to the pending queue. To be
called at startup to recover tasks that were active when the
previous run terminated.
// Recover moves all active tasks to the pending queue . To be // called at startup to recover tasks that were active when the // previous run terminated .
func (q *queue) Recover() error {
	wb := new(leveldb.Batch)
	prefix := bytes.Join([][]byte{activePrefix, []byte{}}, queueKeySep)
	iter := q.db.NewPrefixIterator(prefix)
	defer iter.Release()
	for iter.Next() {
		var p queuePair
		if err := iter.Value(&p); err != nil {
			continue
		}
		p.key = iter.Key()[len(activePrefix)+1:]
		if err := q.db.PutObjBatch(wb, p.key, &p); err != nil {
			return err
		}
		wb.Delete(iter.Key())
	}
	return q.db.Write(wb, nil)
}
func ( q * queue ) Recover ( ) error { wb := new ( leveldb . Batch ) prefix := bytes . Join ( [ ] [ ] byte { activePrefix , [ ] byte { } } , queueKeySep ) iter := q . db . NewPrefixIterator ( prefix ) defer iter . Release ( ) for iter . Next ( ) { var p queuePair if err := iter . Value ( & p ) ; err != nil { continue } p . key = iter . Key ( ) [ len ( activePrefix ) + 1 : ] if err := q . db . PutObjBatch ( wb , p . key , & p ) ; err != nil { return err } wb . Delete ( iter . Key ( ) ) } return q . db . Write ( wb , nil ) }
Recover moves all active tasks to the pending queue.
Recover moves all active tasks to the pending queue .