snapshot will now be compacted whenever aux is loaded
This commit is contained in:
@@ -8,6 +8,7 @@ aux_database = {}
|
||||
function public.on_load()
|
||||
private.perform_migration(aux_database)
|
||||
aux_database.version = DATABASE_VERSION
|
||||
public.load_snapshot().compact()
|
||||
end
|
||||
|
||||
function private.perform_migration()
|
||||
@@ -110,6 +111,14 @@ function private.snapshot(data)
|
||||
return data[signature] ~= nil and data[signature] >= time()
|
||||
end
|
||||
|
||||
function self.compact()
|
||||
for signature, expiration in pairs(data) do
|
||||
if expiration < time() then
|
||||
data[signature] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function self.signatures()
|
||||
local signatures = {}
|
||||
for signature, _ in pairs(data) do
|
||||
|
||||
Reference in New Issue
Block a user