From 83b3a06f9501b63d79e2713092946102c706baa6 Mon Sep 17 00:00:00 2001 From: Shargon Date: Wed, 26 Aug 2020 12:08:16 +0200 Subject: [PATCH] Remove old bug (#331) --- src/LevelDBStore/IO/Data/LevelDB/DB.cs | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/LevelDBStore/IO/Data/LevelDB/DB.cs b/src/LevelDBStore/IO/Data/LevelDB/DB.cs index 75e8f018c..e8b1a33c1 100644 --- a/src/LevelDBStore/IO/Data/LevelDB/DB.cs +++ b/src/LevelDBStore/IO/Data/LevelDB/DB.cs @@ -86,25 +86,8 @@ public static void Repair(string name, Options options) public void Write(WriteOptions options, WriteBatch write_batch) { - // There's a bug in .Net Core. - // When calling DB.Write(), it will throw LevelDBException sometimes. - // But when you try to catch the exception, the bug disappears. - // We shall remove the "try...catch" clause when Microsoft fix the bug. - byte retry = 0; - while (true) - { - try - { - Native.leveldb_write(handle, options.handle, write_batch.handle, out IntPtr error); - NativeHelper.CheckError(error); - break; - } - catch (LevelDBException ex) - { - if (++retry >= 4) throw; - System.IO.File.AppendAllText("leveldb.log", ex.Message + "\r\n"); - } - } + Native.leveldb_write(handle, options.handle, write_batch.handle, out IntPtr error); + NativeHelper.CheckError(error); } } }