unset interrupt BEFORE closing connection
This commit is contained in:
parent
3dcd314ed8
commit
2a9d1cb4f4
|
@ -278,12 +278,15 @@ func (c *SQLiteConn) Close() (err error) {
|
|||
// Set a timeout context to limit execution time.
|
||||
ctx, cncl := context.WithTimeout(ctx, 5*time.Second)
|
||||
old := raw.SetInterrupt(ctx)
|
||||
defer func() { cncl(); raw.SetInterrupt(old) }()
|
||||
|
||||
// see: https://www.sqlite.org/pragma.html#pragma_optimize
|
||||
const onClose = "PRAGMA analysis_limit=1000; PRAGMA optimize;"
|
||||
_ = raw.Exec(onClose)
|
||||
|
||||
// Unset timeout context.
|
||||
_ = raw.SetInterrupt(old)
|
||||
cncl()
|
||||
|
||||
// Finally, release + close.
|
||||
_ = raw.ReleaseMemory()
|
||||
err = raw.Close()
|
||||
|
|
Loading…
Reference in New Issue