mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-12 12:24:35 +01:00
Add a config option for configuring session timeout
This commit is contained in:
@@ -102,6 +102,7 @@ public class Config {
|
|||||||
public boolean autoCreateAccount = true;
|
public boolean autoCreateAccount = true;
|
||||||
public boolean skipIntro = false;
|
public boolean skipIntro = false;
|
||||||
public boolean unlockInstances = true;
|
public boolean unlockInstances = true;
|
||||||
|
public int sessionTimeout = 600; // How long to wait (in seconds) after the last http request from a session before removing it from the server
|
||||||
public int dailyResetHour = 0;
|
public int dailyResetHour = 0;
|
||||||
public int leaderboardRefreshTime = 60; // Leaderboard refresh time in seconds
|
public int leaderboardRefreshTime = 60; // Leaderboard refresh time in seconds
|
||||||
public WelcomeMail welcomeMail = new WelcomeMail();
|
public WelcomeMail welcomeMail = new WelcomeMail();
|
||||||
|
|||||||
@@ -77,7 +77,9 @@ public class GameContext implements Runnable {
|
|||||||
// TODO add timeout to config
|
// TODO add timeout to config
|
||||||
public synchronized void cleanupInactiveSessions() {
|
public synchronized void cleanupInactiveSessions() {
|
||||||
var it = this.getSessions().entrySet().iterator();
|
var it = this.getSessions().entrySet().iterator();
|
||||||
long timeout = System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(600); // 10 minutes
|
|
||||||
|
int time = Nebula.getConfig().getServerOptions().sessionTimeout;
|
||||||
|
long timeout = System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(time);
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
var session = it.next().getValue();
|
var session = it.next().getValue();
|
||||||
|
|||||||
Reference in New Issue
Block a user