Skip to content

Commit

Permalink
corregida diferencia de tiempo en flushEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
mind-ar committed Mar 15, 2024
1 parent 8748991 commit 0f41fec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,13 @@ export const eventsFor = (io: Server, interpreter: Interpreter, dynamicDiagramCl
socket.emit('images', getImages(project, assets))
socket.emit('sizeCanvasInic', [sizeCanvas.width, sizeCanvas.height])

const flushInterval = 100

Check warning on line 205 in src/commands/run.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/run.ts#L205

Added line #L205 was not covered by tests
const id = setInterval(() => {
const gameSingleton = interpreter?.object('wollok.game.game')
socket.emit('cellPixelSize', gameSingleton.get('cellSize')!.innerNumber!)
try {
interpreter.send('flushEvents', gameSingleton, interpreter.reify(timer))
timer += 300
timer += flushInterval

Check warning on line 211 in src/commands/run.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/run.ts#L211

Added line #L211 was not covered by tests
// We could pass the interpreter but a program does not change it
dynamicDiagramClient.onReload()
if (!gameSingleton.get('running')?.innerBoolean) {
Expand All @@ -219,7 +220,7 @@ export const eventsFor = (io: Server, interpreter: Interpreter, dynamicDiagramCl
socket.emit('errorDetected', error.message)
clearInterval(id)
}
}, 100)
}, flushInterval)

socket.on('disconnect', () => {
clearInterval(id)
Expand Down

0 comments on commit 0f41fec

Please sign in to comment.