make sure every rows is closed
This commit is contained in:
parent
5578182bd0
commit
2213f0e935
|
@ -109,24 +109,14 @@ func deliverate(goarounds int, username string, rcpt string, msg []byte) {
|
||||||
|
|
||||||
var pokechan = make(chan int)
|
var pokechan = make(chan int)
|
||||||
|
|
||||||
func redeliverator() {
|
func getdoovers() []Doover {
|
||||||
sleeper := time.NewTimer(0)
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-pokechan:
|
|
||||||
if !sleeper.Stop() {
|
|
||||||
<-sleeper.C
|
|
||||||
}
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
case <-sleeper.C:
|
|
||||||
}
|
|
||||||
|
|
||||||
rows, err := stmtGetDoovers.Query()
|
rows, err := stmtGetDoovers.Query()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("wat?")
|
log.Printf("wat?")
|
||||||
time.Sleep(1 * time.Minute)
|
time.Sleep(1 * time.Minute)
|
||||||
continue
|
return nil
|
||||||
}
|
}
|
||||||
|
defer rows.Close()
|
||||||
var doovers []Doover
|
var doovers []Doover
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var d Doover
|
var d Doover
|
||||||
|
@ -139,7 +129,23 @@ func redeliverator() {
|
||||||
d.When, _ = time.Parse(dbtimeformat, dt)
|
d.When, _ = time.Parse(dbtimeformat, dt)
|
||||||
doovers = append(doovers, d)
|
doovers = append(doovers, d)
|
||||||
}
|
}
|
||||||
rows.Close()
|
return doovers
|
||||||
|
}
|
||||||
|
|
||||||
|
func redeliverator() {
|
||||||
|
sleeper := time.NewTimer(0)
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-pokechan:
|
||||||
|
if !sleeper.Stop() {
|
||||||
|
<-sleeper.C
|
||||||
|
}
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
case <-sleeper.C:
|
||||||
|
}
|
||||||
|
|
||||||
|
doovers := getdoovers()
|
||||||
|
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
nexttime := now.Add(24 * time.Hour)
|
nexttime := now.Add(24 * time.Hour)
|
||||||
for _, d := range doovers {
|
for _, d := range doovers {
|
||||||
|
|
1
web.go
1
web.go
|
@ -586,6 +586,7 @@ func thelistingoftheontologies(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Printf("selection error: %s", err)
|
log.Printf("selection error: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer rows.Close()
|
||||||
var onts [][]string
|
var onts [][]string
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var o string
|
var o string
|
||||||
|
|
Loading…
Reference in New Issue