Skip to content

Commit

Permalink
🪲 Increase timeout for if_pressed programs hedyorg#5678 (hedyorg#5680)
Browse files Browse the repository at this point in the history
Fixes hedyorg#5678
Increased the timeout of if_pressed programs from 10 seconds to 10 minutes. The random failures turned out to be timeouts. While cleaning up the pygame code, I think we accidentally reduced the timeout for if_pressed programs. This surfaced as random failures especially when there are multiple if_pressed executions, e.g. in a `repeat` command.

**How to test**
Go to level 7 and run the following program:
```
repeat 3 times if x is pressed print 'x' else print 'another'
```
Wait for 10 seconds and then press a button. The program should not stop and there should be no errors reports in the network tab of the browser.
  • Loading branch information
boryanagoncharenko authored Jul 31, 2024
1 parent 799c53e commit e6d3cee
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions static/js/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -992,8 +992,8 @@ export function runPythonProgram(this: any, code: string, sourceMap: any, hasTur
// So: a very large limit in these levels, keep the limit on other ones.
execLimit: (function () {
const level = theLevel;
if (hasTurtle || hasMusic) {
// We don't want a timeout when using the turtle or music -> just set one for 10 minutes
if (hasTurtle || hasPressed || hasMusic) {
// We don't want a timeout when using the turtle, if_pressed or music -> just set one for 10 minutes
return (6000000);
}
if (level < 7) {
Expand Down
2 changes: 1 addition & 1 deletion static/js/appbundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -120474,7 +120474,7 @@ def note_with_error(value, err):
},
execLimit: function() {
const level3 = theLevel;
if (hasTurtle || hasMusic) {
if (hasTurtle || hasPressed || hasMusic) {
return 6e6;
}
if (level3 < 7) {
Expand Down
4 changes: 2 additions & 2 deletions static/js/appbundle.js.map

Large diffs are not rendered by default.

0 comments on commit e6d3cee

Please sign in to comment.