flashmob / go-guerrilla

Mini SMTP server written in golang
MIT License
2.79k stars 366 forks source link

Unused timeout variable #168

Closed tegk closed 5 years ago

tegk commented 5 years ago

What was supposed to be done with the timeout variable "tOut"? As long as I see here the variables gets assigned but not used. Shall I clean up and delete code that relates to "tOut"?

backends/p_guerrilla_db_redis.go

func (g *GuerrillaDBAndRedisBackend) sqlConnect() (*sql.DB, error) {
    tOut := GuerrillaDBAndRedisBatchTimeout
    if g.config.BatchTimeout > 0 {
        tOut = time.Duration(g.config.BatchTimeout)
    }
    tOut += 10
    // don't go to 30 sec or more
    if tOut >= 30 {
        tOut = 29
    }
    if db, err := sql.Open(g.config.Driver, g.config.DSN); err != nil {
        Log().Error("cannot open database", err, "]")
        return nil, err
    } else {
        // do we have access?
        _, err = db.Query("SELECT mail_id FROM " + g.config.Table + " LIMIT 1")
        if err != nil {
            Log().Error("cannot select table:", err)
            return nil, err
        }
        return db, nil
    }
}
flashmob commented 5 years ago

Looks like an old relic that can be safely removed. Thanks!