Avoid double-execution within a round; see syndicate-lang/syndicate-js#3

This commit is contained in:
Tony Garnock-Jones 2023-12-19 23:18:22 +13:00
parent 16763a8b4f
commit f785274e35
1 changed files with 6 additions and 3 deletions

View File

@ -54,11 +54,14 @@
(define workset (dataflow-graph-damaged-nodes g))
(when (not (hash-empty? workset))
(set-dataflow-graph-damaged-nodes! g (hash))
(define updated (make-hash))
(hash-for-each workset
(lambda (object-id _)
(for [(subject-id
(in-hashset-values (dataflow-graph-edges-forward g) object-id))]
(dataflow-forget-subject! g subject-id)
(parameterize ((current-dataflow-subject-id subject-id))
(repair-node! subject-id)))))
(when (not (hash-has-key? updated subject-id))
(hash-set! updated subject-id #t)
(dataflow-forget-subject! g subject-id)
(parameterize ((current-dataflow-subject-id subject-id))
(repair-node! subject-id))))))
(loop))))