Optimize boot time

This commit is contained in:
utkabobr committed 2025-04-01 23:06:08 +03:00
1 parent 6092f123b5
commit 662018834e
14 files changed
+337 -41

No files matched your search

@@ -0,0 +1,24 @@
package ru.ytkab0bp.slicebeam.boot;
import org.json.JSONException;
import org.json.JSONObject;
import ru.ytkab0bp.slicebeam.BeamServerData;
import ru.ytkab0bp.slicebeam.SliceBeam;
import ru.ytkab0bp.slicebeam.utils.Prefs;
public class BeamServerDataTask extends BootTask {
public BeamServerDataTask() {
super(() -> {
try {
SliceBeam.SERVER_DATA = new BeamServerData(new JSONObject(Prefs.getBeamServerData()));
} catch (JSONException e) {
throw new RuntimeException(e);
}
if (System.currentTimeMillis() - Prefs.getLastCheckedInfo() >= 86400000L) {
BeamServerData.load();
}
});
onWorker();
}
}