Optimize interrupts.

This commit is contained in:
Nuno Cruces
2023-12-14 17:22:25 +00:00
parent 3f8b480ba0
commit c68413bd53

View File

@@ -103,7 +103,7 @@ func (c *Conn) openDB(filename string, flags OpenFlag) (uint32, error) {
return 0, err return 0, err
} }
} }
c.call("sqlite3_progress_handler_go", uint64(handle), 100)
return handle, nil return handle, nil
} }
@@ -252,12 +252,10 @@ func (c *Conn) SetInterrupt(ctx context.Context) (old context.Context) {
c.interrupt = ctx c.interrupt = ctx
// Remove the handler if the context can't be canceled. // Remove the handler if the context can't be canceled.
if ctx == nil || ctx.Done() == nil { if ctx == nil || ctx.Done() == nil {
c.call("sqlite3_progress_handler_go", uint64(c.handle), 0)
return old return old
} }
c.pending.Step() c.pending.Step()
c.call("sqlite3_progress_handler_go", uint64(c.handle), 100)
return old return old
} }