[Added] Nightly filling up of fresh data (and swapping), Startup filling of DB, sessionToken for bulk gathering

This commit is contained in:
Ninjaws
2024-11-03 01:43:47 +01:00
parent 121dff910d
commit ec5a1de584
28 changed files with 365 additions and 700 deletions
@@ -38,7 +38,7 @@ public class QuizService {
/** First, we check if there are already enough items in our db */
List<QuestionEntity> questionsRetrieved = dataService.lookupQuestions(quizSettings);
if(!questionsRetrieved.isEmpty()) {
if(!questionsRetrieved.isEmpty() && questionsRetrieved.size() == quizSettings.getAmount()) {
session.setQuestions(cleanerService.questionListEntitytoDTO(questionsRetrieved));
}
@@ -47,7 +47,7 @@ public class QuizService {
/**
* If the questions were retrieved from the DB, then it doesn't need to be added to the queue
*/
if(!questionsRetrieved.isEmpty()) {
if(!questionsRetrieved.isEmpty() && questionsRetrieved.size() == quizSettings.getAmount()) {
return Optional.of(session.getId());
}
@@ -81,9 +81,10 @@ public class QuizService {
}
/** Anything other than statuscode 0 doesn't result in active sessions, so remove them from the cache after reporting to the frontend */
if(session.getStatusCode() != 0) {
cacheService.removeFromCache(session.getId());
}
// if(session.getStatusCode() != 0) {
/** Regardless of status code, this link is not reusable */
cacheService.removeFromCache(session.getId());
// }
return Optional.of(session);
}