Skip apply-patch! make-work if patch is empty
This commit is contained in:
parent
69a8893da3
commit
ef4584a60f
|
@ -362,18 +362,19 @@
|
|||
(run-all-pending-scripts! ds))))
|
||||
|
||||
(define (apply-patch! ds ac delta [restriction-path #f])
|
||||
(define ds-assertions (dataspace-assertions ds))
|
||||
(define rt (dataspace-routing-table ds))
|
||||
(define new-cleanup-changes
|
||||
(for/fold [(cleanup-changes (actor-cleanup-changes ac))] [((a count) (in-bag/count delta))]
|
||||
(match (bag-change! ds-assertions (cons a restriction-path) count)
|
||||
['present->absent (remove-assertion! rt a restriction-path)]
|
||||
['absent->present (add-assertion! rt a restriction-path)]
|
||||
;; 'absent->absent absurd
|
||||
['present->present (void)]) ;; i.e. no visible change
|
||||
(define-values (updated-bag _summary) (bag-change cleanup-changes a (- count)))
|
||||
updated-bag))
|
||||
(set-actor-cleanup-changes! ac new-cleanup-changes))
|
||||
(when (not (bag-empty? delta))
|
||||
(define ds-assertions (dataspace-assertions ds))
|
||||
(define rt (dataspace-routing-table ds))
|
||||
(define new-cleanup-changes
|
||||
(for/fold [(cleanup-changes (actor-cleanup-changes ac))] [((a count) (in-bag/count delta))]
|
||||
(match (bag-change! ds-assertions (cons a restriction-path) count)
|
||||
['present->absent (remove-assertion! rt a restriction-path)]
|
||||
['absent->present (add-assertion! rt a restriction-path)]
|
||||
;; 'absent->absent absurd
|
||||
['present->present (void)]) ;; i.e. no visible change
|
||||
(define-values (updated-bag _summary) (bag-change cleanup-changes a (- count)))
|
||||
updated-bag))
|
||||
(set-actor-cleanup-changes! ac new-cleanup-changes)))
|
||||
|
||||
(define (run-scripts! ds)
|
||||
(run-all-pending-scripts! ds)
|
||||
|
|
Loading…
Reference in New Issue