mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-23 19:00:13 +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 #406.
This commit is contained in:
parent
2a2f8ec94e
commit
adc6720031
7
ga4.js
7
ga4.js
@ -43,9 +43,10 @@ window.fetch = async (...args) => {
|
|||||||
const startTime = window.performance.now();
|
const startTime = window.performance.now();
|
||||||
let endTime, errorMessage;
|
let endTime, errorMessage;
|
||||||
try {
|
try {
|
||||||
// The fetch_with_timeout function defaults to a 6000 ms timeout. We use a
|
// The fetch_with_timeout function from book.js defaults to a 15000 ms
|
||||||
// slightly shorter timeout so that we can catch and log the error.
|
// timeout. We use a slightly shorter timeout so that we can catch and log
|
||||||
config.signal = AbortSignal.timeout(5500);
|
// the error.
|
||||||
|
config.signal = AbortSignal.timeout(14500);
|
||||||
let response = await originalFetch(resource, config);
|
let response = await originalFetch(resource, config);
|
||||||
payload = await response.json();
|
payload = await response.json();
|
||||||
errorMessage = (payload.error == null) ? null : 'compilation_error';
|
errorMessage = (payload.error == null) ? null : 'compilation_error';
|
||||||
|
2
third_party/mdbook/book.js
vendored
2
third_party/mdbook/book.js
vendored
@ -18,7 +18,7 @@ function playground_text(playground, hidden = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
(function codeSnippets() {
|
(function codeSnippets() {
|
||||||
function fetch_with_timeout(url, options, timeout = 6000) {
|
function fetch_with_timeout(url, options, timeout = 15000) {
|
||||||
return Promise.race([
|
return Promise.race([
|
||||||
fetch(url, options),
|
fetch(url, options),
|
||||||
new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), timeout))
|
new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), timeout))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user