1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-01 17:34:25 +02:00

Increase playground timeout to 15 seconds

We often see timeouts when running the course. Most of the time, the
code compiles on the second try, which indicates that we just need to
wait a little longer.

Fixes .
This commit is contained in:
Martin Geisler 2023-03-01 11:54:28 +01:00 committed by Martin Geisler
parent 2a2f8ec94e
commit adc6720031
2 changed files with 5 additions and 4 deletions
ga4.js
third_party/mdbook

7
ga4.js

@ -43,9 +43,10 @@ window.fetch = async (...args) => {
const startTime = window.performance.now();
let endTime, errorMessage;
try {
// The fetch_with_timeout function defaults to a 6000 ms timeout. We use a
// slightly shorter timeout so that we can catch and log the error.
config.signal = AbortSignal.timeout(5500);
// The fetch_with_timeout function from book.js defaults to a 15000 ms
// timeout. We use a slightly shorter timeout so that we can catch and log
// the error.
config.signal = AbortSignal.timeout(14500);
let response = await originalFetch(resource, config);
payload = await response.json();
errorMessage = (payload.error == null) ? null : 'compilation_error';

@ -18,7 +18,7 @@ function playground_text(playground, hidden = true) {
}
(function codeSnippets() {
function fetch_with_timeout(url, options, timeout = 6000) {
function fetch_with_timeout(url, options, timeout = 15000) {
return Promise.race([
fetch(url, options),
new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), timeout))