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

View File

@ -2197,6 +2197,21 @@
++ reduce ++ reduce
|= build-receipts=(list build-receipt) |= build-receipts=(list build-receipt)
^+ ..execute ^+ ..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 |^ ^+ ..execute
?~ build-receipts ..execute ?~ build-receipts ..execute
@ -2596,15 +2611,9 @@
:: ::
%+ roll blocks %+ roll blocks
|= [block=^build state=_state] |= [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 ?< (~(has by results.state) block)
:: 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
:: ::
%_ state %_ state
blocked-builds blocked-builds