+ Added database flush command

This commit is contained in:
Matthew Cech
2019-05-24 00:17:18 -07:00
parent 2ee17dcc79
commit 434ff1b46b
3 changed files with 47 additions and 2 deletions
+6 -1
View File
@@ -39,10 +39,12 @@ public class DatabaseManager
// Thumbs through registered objects and syncs them with the database.
// Consider moving this operation to a separate thread.
public void Upkeep()
public int Upkeep()
{
synchronized(trackedObjects)
{
int numUpdated = 0;
for(int i = 0 ; i < trackedObjects.size(); ++i)
{
DatabaseTrackedObject dto = trackedObjects.get(i);
@@ -51,8 +53,11 @@ public class DatabaseManager
{
SetRemoteValue(dto.identifier, dto.Serialize());
dto.Resolve();
++numUpdated;
}
}
return numUpdated;
}
}