Remove: use_async

This commit is contained in:
Coder12a 2019-10-15 11:11:51 -05:00
parent 94b62ac5ab
commit ed7b5996a7

View File

@ -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)