fix clip to when stock not set or invalid. fix client/worker signaling for null-callbacks

This commit is contained in:
Stewart Allen 2021-03-15 15:20:50 -04:00
commit 603a46e432
5 changed files with 21 additions and 10 deletions

View file

@ -28,8 +28,11 @@ let KIRI = self.kiri = self.kiri || {},
function send(fn, data, onreply, zerocopy) {
let seq = seqid++;
running[seq] = { fn:onreply };
// console.log('send', data);
if (onreply) {
// track it only when we expect and can handle a reply
running[seq] = { fn:onreply };
}
// console.log('send', {fn, data, onreply});
try {
worker.postMessage({
@ -59,6 +62,7 @@ KIRI.work = {
isBusy: function() {
let current = 0;
for (let rec of Object.values(running)) {
if (rec.fn) current++;
}
@ -92,7 +96,7 @@ KIRI.work = {
let now = time(),
reply = e.data,
record = running[reply.seq],
onreply = record.fn;
onreply = record ? record.fn : undefined;
// console.log('recv', reply.data)
if (reply.done) {
@ -102,7 +106,11 @@ KIRI.work = {
// calculate and replace recv time
reply.time_recv = now - reply.time_recv;
onreply(reply.data, reply);
if (onreply) {
onreply(reply.data, reply);
} else {
console.log({unexpected_reply: reply});
}
};
restarting = false;

View file

@ -248,7 +248,6 @@
API.dialog.hide();
// cancel slicing
API.function.cancel();
// if (KIRI.work.isSlicing()) KIRI.work.restart();
// kill any poppers in compact mode
UC.hidePoppers();
// and send an event (used by FDM client)

View file

@ -62,6 +62,7 @@ KIRI.worker = {
}
}
}
send.done(data.id);
return;
}