Skip to content

Commit

Permalink
Fixed GlobalUpdates error
Browse files Browse the repository at this point in the history
  • Loading branch information
noahrepublic committed Feb 14, 2024
1 parent 9528776 commit 3f4a6d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# DataKeep

## [version 3.0.5](https://github.com/noahrepublic/DataKeep/releases/tag/v3.0.5): 02/13/2024

### Fixed

- GlobalUpdates returning nil causing an error

## [version 3.0.4](https://github.com/noahrepublic/DataKeep/releases/tag/v3.0.4): 01/21/2024

### Fixed
Expand Down
34 changes: 14 additions & 20 deletions src/Keep.lua
Original file line number Diff line number Diff line change
Expand Up @@ -542,32 +542,26 @@ function Keep:_save(newestData: KeepStruct, release: boolean) -- used to interna
return resolve()
end)
end

--local processors = {}
local processUpdates = {} -- we want to run them in batch, so half are saved and half aren't incase of specific needs

for i = 1, #globalUpdates do
if not globalUpdates[i].Locked then
self.GlobalStateProcessor(globalUpdates[i].Data, function()
table.insert(processUpdates, function()
lockGlobalUpdate(i)
end)
end, function()
table.insert(processUpdates, function()
removeLockedUpdate(i, globalUpdates[i].ID)
if globalUpdates then
for i = 1, #globalUpdates do
if not globalUpdates[i].Locked then
self.GlobalStateProcessor(globalUpdates[i].Data, function()
table.insert(processUpdates, function()
lockGlobalUpdate(i)
end)
end, function()
table.insert(processUpdates, function()
removeLockedUpdate(i, globalUpdates[i].ID)
end)
end)
end)

--table.insert(processors, processor)
end
end
else
self.GlobalUpdates = DefaultGlobalUpdates
end

-- Promise.all(processors):andThen(function()
-- Promise.all(processUpdates):timeout(1 / 60):catch(function()
-- error("GlobalUpdate processor cannot yield")
-- end) -- run in bulk
-- end)

for _, updateProcessor in processUpdates do
updateProcessor()
end
Expand Down
2 changes: 1 addition & 1 deletion wally.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "noahrepublic/datakeep"
description = "The final data saving solution you need"
version = "3.0.4"
version = "3.0.5"
license = "MIT"
authors = ["noahrepublic"]
registry = "https://github.com/UpliftGames/wally-index"
Expand Down

0 comments on commit 3f4a6d7

Please sign in to comment.