LOCK Issue on windows on exposed API

Hey @supergeoff, ideally you should be using a single DB instance across all your queries. Open a DB during server initialization and pass it around the system.

The problem with your current approach is that if two requests are received at the same time, only one of them will be able to open badger and read data from it. This could become a serious problem eventually.

If you wish you open a new DB instance for every request, you might want to set the BypassDirLock option badger/options.go at 09dd2e1a4195dbd801ffd09292aa8c9da31e25fc · dgraph-io/badger · GitHub . Please be aware that you might corrupt your data if BypassDir option is set and two write requests are being processed at the same time.

As for the 200ms delay, I think it depends on your disk/OS. We use a system call to lock/unlock the directories badger/dir_windows.go at 09dd2e1a4195dbd801ffd09292aa8c9da31e25fc · dgraph-io/badger · GitHub

Hope this answers your queries.