Exemple #1
0
func (c *DeleteCommand) deleteJob(t *beanstalk.Tube) error {
	var id uint64
	var body []byte
	var err error

	switch c.State {
	case "buried":
		id, body, err = t.PeekBuried()
	case "ready":
		id, body, err = t.PeekReady()
	case "delayed":
		id, body, err = t.PeekDelayed()
	}

	if err != nil {
		return err
	}

	if c.Print {
		c.PrintJob(id, body)
	}

	c.conn.Delete(id)

	return nil
}
Exemple #2
0
func peekState(t beanstalk.Tube, state string) (id uint64, body []byte, err error) {
	switch state {
	case "ready":
		return t.PeekReady()
	case "delayed":
		return t.PeekDelayed()
	case "buried":
		return t.PeekBuried()
	}
	return
}