Refactor code execution to use async functions
This refactoring is required for Sentry tracing. It ensures that the respective functions only return as soon as a code execution finished. With this approach, we can then instrument the duration of the functions, so that Sentry spans are created as desired. Co-authored-by: Jan Graichen <jgraichen@altimos.de>
This commit is contained in:

committed by
Sebastian Serth

parent
c8609e5392
commit
86c67f3c9a
@@ -8,17 +8,19 @@ CodeOceanEditorEvaluation = {
|
||||
* Scoring-Functions
|
||||
*/
|
||||
scoreCode: function (event) {
|
||||
event.preventDefault();
|
||||
const cause = $('#assess');
|
||||
this.startSentryTransaction(cause);
|
||||
event.preventDefault();
|
||||
this.stopCode(event);
|
||||
this.clearScoringOutput();
|
||||
$('#submit').addClass("d-none");
|
||||
this.createSubmission(cause, null, function (submission) {
|
||||
this.showSpinner($('#assess'));
|
||||
$('#score_div').removeClass('d-none');
|
||||
this.initializeSocketForScoring(submission.id);
|
||||
}.bind(this));
|
||||
|
||||
const submission = await this.createSubmission(cause, null).catch(this.ajaxError.bind(this));
|
||||
if (!submission) return;
|
||||
|
||||
this.showSpinner($('#assess'));
|
||||
$('#score_div').removeClass('d-none');
|
||||
await this.socketScoreCode(submission.id);
|
||||
},
|
||||
|
||||
handleScoringResponse: function (results) {
|
||||
|
Reference in New Issue
Block a user