From 15ffe243fa3a141faf108ce698d91e15e4805761 Mon Sep 17 00:00:00 2001 From: Evgeny Skvortsov <71790359+EvgSkv@users.noreply.github.com> Date: Thu, 12 Sep 2024 20:43:38 -0700 Subject: [PATCH] Implementing slowdown of robot.html. --- docs/logica.js | 8 +++++++- docs/robot.html | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/logica.js b/docs/logica.js index 8ea8cdf8..944579a7 100644 --- a/docs/logica.js +++ b/docs/logica.js @@ -55,7 +55,13 @@ self.onmessage = function(event) { console.log('Compiling predicate...'); let program = data.program; let predicate = data.predicate; - let result = self.compile_predicate(program, predicate).toJs(); + let result = new Map(); + result.set('result', 'select \'hi\';') + result.set('status', 'error') + result.set('error_message', 'Compiler is not ready.') + if (self.compile_predicate) { + result = self.compile_predicate(program, predicate).toJs(); + } result.set('type', 'compile_predicate'); console.log(result); self.postMessage(result); diff --git a/docs/robot.html b/docs/robot.html index 8f02c588..2c98bdd5 100644 --- a/docs/robot.html +++ b/docs/robot.html @@ -275,6 +275,12 @@ setTimeout(() => {console.log('Called here!'); outputResult(worker_response)}, 100); //outputResult(worker_response); theSQL = 'BROKEN'; + if (worker_response.get('error_message') == 'Compiler is not ready.') { + compile_attempt += 1; + setTimeout(() => {console.log('Trying to compile again.'); digest();}, 100); + worker_response.set('error_message', + worker_response.get('error_message') + ' / Attempt ' + compile_attempt) + } return; } theSQL = worker_response.get('result'); @@ -686,7 +692,8 @@ let speed_of_time = 1.0; let desire_balance_threshold = 4; - setTimeout(digest, 15000); + let compile_attempt = 0; + setTimeout(digest, 1000); let interval_of_timeStep = setInterval(timeStep, 5); let interval_of_requestDesire2 = setInterval(requestDesire2, 50);