Database opened multiple times
- Dominant language
- Go
- Stars
- 190
- Forks
- 65
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 10
Description
I was wondering if there's a preferred way to cleanly close all database connections. When running the sample code, `sql.open()` will get called twice, but `db.close()` will only get called once. My understanding is that the k6 lifecycle will run code any [init code multiple times](https://community.k6.io/t/why-init-called-4-times/973). Moving the `sql.open()` to `setup()` doesn't work.
It doesn't look like k6 supports a way to only run the init stage once. The `db.close()` in `teardown()` will only close one connection. I can't tell if some other mechanism is closing the extra connection, but unneeded connections to the database may degrade load test performance. Is there a recommended approach to this issue?
Contributor guide
Assessment
This issue has not been assessed yet.