From ed7b5996a719ce575f6aa0eebf18bba1725faac2 Mon Sep 17 00:00:00 2001 From: Coder12a <38924418+Coder12a@users.noreply.github.com> Date: Tue, 15 Oct 2019 11:11:51 -0500 Subject: [PATCH] Remove: use_async --- colddb.lua | 46 +++++----------------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/colddb.lua b/colddb.lua index 7aaba5a..da3f830 100644 --- a/colddb.lua +++ b/colddb.lua @@ -15,7 +15,6 @@ function colddb.Colddb(dir) local mem_pool_del = {} local add_to_mem_pool = true local async = async.Async() - local use_async = true local serializer = minetest.serialize local deserializer = minetest.deserialize local serializer_type = colddb.serializers.default @@ -60,10 +59,6 @@ function colddb.Colddb(dir) return add_to_mem_pool end - self.use_async = function(value) - use_async = value - end - self.get_serializer_type = function() return serializer_type end @@ -152,18 +147,9 @@ function colddb.Colddb(dir) end self.save_mem = function(name) - if use_async then - async.queue_task(function() - if mem_pool[name] ~= nil then - save_table(name, mem_pool[name].mem) - end - end) - else - if mem_pool[name] ~= nil then - save_table(name, mem_pool[name].mem) - end + if mem_pool[name] ~= nil then + save_table(name, mem_pool[name].mem) end - mem_pool_del[name] = nil end @@ -173,30 +159,15 @@ function colddb.Colddb(dir) end self.set = function(name, _table) - if use_async then - async.queue_task(function() - save_table(name, _table) - end) - else - save_table(name, _table) - end - + save_table(name, _table) if add_to_mem_pool then load_into_mem(name, _table) end - mem_pool_del[name] = nil end self.set_key = function(name) - if use_async then - async.queue_task(function() - save_key(name) - end) - else - save_key(name) - end - + save_key(name) if add_to_mem_pool then load_into_mem(name, "") end @@ -282,14 +253,7 @@ function colddb.Colddb(dir) self.remove = function(name) mem_pool[name] = nil mem_pool_del[name] = true - - if use_async then - async.queue_task(function() - delete_file(name) - end) - else - delete_file(name) - end + delete_file(name) end self.sub_database = function(path)