fix rows are closed err on summary cache miss
This commit is contained in:
12
main.go
12
main.go
@@ -609,12 +609,14 @@ func fetchInitialSummaries(state *state) {
|
|||||||
if err != nil && !errors.Is(err, sql.ErrNoRows) {
|
if err != nil && !errors.Is(err, sql.ErrNoRows) {
|
||||||
slog.Warn("unable to get cached weather summary", "location", locKey, "error", err)
|
slog.Warn("unable to get cached weather summary", "location", locKey, "error", err)
|
||||||
} else if err == nil {
|
} else if err == nil {
|
||||||
rows.Next()
|
defer rows.Close()
|
||||||
err = rows.Scan(&summary)
|
ok := rows.Next()
|
||||||
if err != nil {
|
if ok {
|
||||||
slog.Warn("unable to get cached weather summary", "location", locKey, "error", err)
|
err = rows.Scan(&summary)
|
||||||
|
if err != nil {
|
||||||
|
slog.Warn("unable to get cached weather summary", "location", locKey, "error", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rows.Close()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if summary == "" {
|
if summary == "" {
|
||||||
|
Reference in New Issue
Block a user