Exemple #1
0
func clean_processes(app, api string) {
	cl := heroku.New(app, api)
	ps, err := cl.List()
	if err != nil {
		log.Printf("error listing process: %s", err)
		return
	}

	for _, p := range ps {
		//only kill processes running longer than too long
		if p.Elapsed <= too_long {
			continue
		}
		//only kill processes that are in the run command type
		if strings.HasPrefix(p.Process, "run") {
			continue
		}

		//KEEL IT
		err := cl.Kill(p.Process)
		if err != nil {
			log.Printf("error killing %s: %s", p.Process, err)
		}
	}
}
Exemple #2
0
func (c Config) BuildHerokuClient() *heroku.Client {
	return heroku.New(c.App, c.Api)
}