Open Strohgelaender opened 1 year ago
The server generates repos and build plans so we cannot make it a lot faster. However, we can check if the student exam already exists and only create one and immediately save it if it does not exist. A loading screen / progress bar on the client might also help to prevent that students execute this action multiple times
I just looked into it again and the repos/build plans are generated at a later point of time, so this could not be the issue.
I am not sure why this is slow, maybe SecureRandom in StudentExamRepository:313
is sometimes slow?
see e.g. https://stackoverflow.com/questions/137212/how-to-deal-with-a-slow-securerandom-generator
I am not sure if we really need a SecureRandom here
Describe the bug
For test exams, student exams get automatically generated when the student opens the exam for the first time.
On our production system, we noticed some cases where generating one individual exam would take up to 8 seconds:
This is an issue, since the student can and might do additional requests during this generation time. This leads to multiple student exams related to the same user:
Artemis assumes that one student can only have up to one student exam, so this leads to internal server errors:![grafik](https://user-images.githubusercontent.com/26540346/217046925-9d17dd9e-7b0f-473c-af8f-20426828a6e7.png)
To Reproduce
Create a new student exam for a test exam.
Expected behavior
Each student should only have one related student exam. The generation process should only take a few ms.
Screenshots
Which version of Artemis are you seeing the problem on?
6.0.2
What browsers are you seeing the problem on?
Other (specify in "Additional context")
Additional context
Generation of StudentExams: StudentExamRepository#createRandomStudentExams
Relevant log output
No response