I am trying to execute some insert queries one query per goroutine (see code from emulating multiple requests to sqlite database as goroutine causes random panic) but most of failed with error: The database file is locked.
I found following from http://godoc.org/code.google.com/p/go-sqlite/go1/sqlite3#BusyFunc :
type BusyFunc func(count int) (retry bool)
BusyFunc is a callback function invoked by SQLite when it is unable to acquire a lock on a table. Count is the number of times that the callback has been invoked for this locking event so far. If the function returns false, then the operation is aborted. Otherwise, the function should block for a while before returning true and letting SQLite make another locking attempt.
I inserted following code:
sqlite3.BusyFunc(func(counted int) (bool) {
if counted > 10 {
return false
} else {
return true
}
})
but it returned sqlite3.BusyFunc(func literal) evaluated but not used
. Am I missing something?