sort +build-receipt's in +reduce

This commit is contained in:
Ted Blackman 2018-05-15 14:44:48 -07:00
parent 08ef5dbe2b
commit ca9acf23ba
2 changed files with 25 additions and 15 deletions

View File

@ -1684,10 +1684,10 @@
::
=/ scry-results=(map [term beam] cage)
%- my :~
:- [%cx [[~nul %desk %da ~1234.5.6] /bar/foo]]
:- [%cx [[~nul %home %da ~1234.5.6] /bar/foo]]
[%noun scry-type %it-does-in-fact-matter]
::
:- [%cx [[~nul %desk %da ~1234.5.7] /bar/foo]]
:- [%cx [[~nul %home %da ~1234.5.7] /bar/foo]]
[%noun scry-type %it-does-in-fact-matter]
==
::
@ -1695,7 +1695,7 @@
=/ ford *ford-gate
::
=/ formula=hoon (ream '`@tas`%constant')
=/ subject-schematic=schematic:ford [%scry %c %x [~nul %desk] /bar/foo]
=/ subject-schematic=schematic:ford [%scry %c %x [~nul %home] /bar/foo]
::
=/ ride-type=type [%atom %tas ~]
=/ ride=schematic:ford [%ride formula subject-schematic]
@ -1717,6 +1717,7 @@
[%success [%ride ride-type %constant]]
[%success [%scry %noun scry-type %it-does-in-fact-matter]]
== == ==
~& %results1
::
=^ results2 ford
%- test-ford-call :*
@ -1731,8 +1732,8 @@
[%success [%ride ride-type %constant]]
[%success [%scry %noun scry-type %it-does-in-fact-matter]]
==
:* duct=~ %pass wire=/~nul/clay-sub/~nul/desk
%c %warp [~nul ~nul] %desk
:* duct=~ %pass wire=/~nul/clay-sub/~nul/home
%c %warp [~nul ~nul] %home
`[%mult [%da ~1234.5.7] (sy [%x /foo/bar] ~)]
== == ==
::
@ -1756,8 +1757,8 @@
call-args=[duct=~[/autocons] type=~ %kill ~nul]
::
^= moves
:~ :* duct=~ %pass wire=/~nul/clay-sub/~nul/desk
%c %warp [~nul ~nul] %desk ~
:~ :* duct=~ %pass wire=/~nul/clay-sub/~nul/home
%c %warp [~nul ~nul] %home ~
== == ==
::
;: weld

View File

@ -2197,6 +2197,21 @@
++ reduce
|= build-receipts=(list build-receipt)
^+ ..execute
:: sort :build-receipts so blocks are processed before completions
::
:: It's possible for a build to block on a sub-build that was run
:: in the same batch. If that's the case, make sure we register
:: that the build blocked on the sub-build before registering the
:: completion of the sub-build. This way, when we do register the
:: completion of the sub-build, we will know which builds are blocked
:: on the sub-build, so we can enqueue those blocked clients to be
:: rerun.
::
=. build-receipts
%+ sort build-receipts
|= [a=build-receipt b=build-receipt]
^- ?
?=(%blocks -.result.a)
::
|^ ^+ ..execute
?~ build-receipts ..execute
@ -2596,15 +2611,9 @@
::
%+ roll blocks
|= [block=^build state=_state]
:: deal with block already being unblocked
:: we must run +apply-build-receipt on :build.made before :block
::
:: If :block was run in the same batch as :build.made, and we've
:: already processed its result, then :build.made has already
:: been unblocked. Don't reblock ourselves since nothing will
:: unblock us.
::
?: (~(has by results.state) block)
state
?< (~(has by results.state) block)
::
%_ state
blocked-builds