Skip to content

Commit

Permalink
Move timer to correct place
Browse files Browse the repository at this point in the history
  • Loading branch information
l7ssha committed Nov 21, 2024
1 parent 15fc485 commit 30113f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/src/web_app/session_manager_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class SessionManagerPlugin extends NyxxPlugin<NyxxGateway> {
}

@override
FutureOr<void> afterConnect(NyxxGateway client) {
restoreSessions(() async {
FutureOr<void> afterConnect(NyxxGateway client) async {
await restoreSessions(() async {
final file = File(_sessionsFile);
if (await file.exists()) {
logger.info("Loading session file.");
Expand All @@ -26,12 +26,12 @@ class SessionManagerPlugin extends NyxxPlugin<NyxxGateway> {
logger.info("Session file missing. Returning default");
return '{}';
});

Timer.periodic(Duration(minutes: 15), (timer) => _saveSessions());
}

@override
FutureOr<void> afterClose() async {
_saveSessions();

Timer.periodic(Duration(minutes: 15), (timer) => _saveSessions());
}
}

0 comments on commit 30113f2

Please sign in to comment.