summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2023-09-21 14:40:43 +0200
committerSimon Rettberg2023-09-21 14:40:43 +0200
commitee27ff639e468c7ec6e237956b20ed6c720f788f (patch)
tree077fdfd6ac35c0d5dbf6a548ac6ac804919e03df
parent[client] Check if VM is suspended before upload (diff)
downloadtutor-module-ee27ff639e468c7ec6e237956b20ed6c720f788f.tar.gz
tutor-module-ee27ff639e468c7ec6e237956b20ed6c720f788f.tar.xz
tutor-module-ee27ff639e468c7ec6e237956b20ed6c720f788f.zip
[server] Force update of os, virt and org lists every 3 hours
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java11
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbOrganization.java3
2 files changed, 11 insertions, 3 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java
index 472f2578..898f75e9 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/App.java
@@ -43,6 +43,7 @@ import org.openslx.util.AppUtil;
import org.openslx.util.GrowingThreadPoolExecutor;
import org.openslx.util.PrioThreadFactory;
import org.openslx.util.QuickTimer;
+import org.openslx.util.QuickTimer.Task;
public class App {
@@ -144,6 +145,14 @@ public class App {
+ " Please make sure this server can connect to the internet.");
return;
}
+ // Update once an hour
+ QuickTimer.scheduleAtFixedDelay(new Task() {
+ public void fire() {
+ VirtualizerList.get();
+ OperatingSystemList.get();
+ OrganizationList.get();
+ }
+ }, 3601_000, 3601_000 * 3);
// Start file transfer server
if (!FileServer.instance().start()) {
@@ -152,7 +161,7 @@ public class App {
}
// Start watch dog to ensure nobody else is messing with the vmstore
- QuickTimer.scheduleAtFixedDelay(new StorageUseCheck(), 10000, 60000);
+ QuickTimer.scheduleAtFixedDelay(new StorageUseCheck(), 10_000, 60_000);
// Set a flag that we need to convert userids if applicable
DbUser.checkIfLegacyUsersExist();
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbOrganization.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbOrganization.java
index 7261b189..6d999573 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbOrganization.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbOrganization.java
@@ -26,7 +26,7 @@ public class DbOrganization {
* @return
* @throws SQLException
*/
- public static boolean storeOrganizations(List<Organization> organizations) throws SQLException {
+ public static void storeOrganizations(List<Organization> organizations) throws SQLException {
try (MysqlConnection connection = Database.getConnection()) {
MysqlStatement stmt = connection.prepareStatement("INSERT INTO organization"
+ " (organizationid, displayname, canlogin) VALUES (:id, :name, 0)"
@@ -37,7 +37,6 @@ public class DbOrganization {
stmt.executeUpdate();
}
connection.commit();
- return true;
} catch (SQLException e) {
LOGGER.error("Query failed in DbOrganization.storeOrganization()", e);
throw e;