diff --git a/main.go b/main.go index 00df9dc..c5e4a93 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "encoding/json" "errors" "os" + "time" "github.com/boltdb/bolt" ) @@ -26,7 +27,9 @@ func GetMagic() int64 { //export Bolt_Open func Bolt_Open(path string) (ObjectReference, *C.char, int) { - ptrDB, err := bolt.Open(path, os.FileMode(0644), bolt.DefaultOptions) + opts := *bolt.DefaultOptions + opts.Timeout = 10 * time.Second + ptrDB, err := bolt.Open(path, os.FileMode(0644), &opts) if err != nil { errMsg := err.Error() return 0, C.CString(errMsg), len(errMsg)