@@ -173,15 +173,6 @@ func (p *Plugin) getHealthyShards(shardHealth map[uint32]int) []uint32 {
173173}
174174
175175func (p * Plugin ) Outcome (_ context.Context , outctx ocr3types.OutcomeContext , _ types.Query , aos []types.AttributedObservation ) (ocr3types.Outcome , error ) {
176- // Bootstrap with 1 shard on first round; subsequent rounds build on prior outcome
177- prior := & pb.Outcome {}
178- if outctx .PreviousOutcome == nil {
179- prior .Routes = map [string ]* pb.WorkflowRoute {}
180- prior .State = & pb.RoutingState {Id : outctx .SeqNr , State : & pb.RoutingState_RoutableShards {RoutableShards : 1 }}
181- } else if err := proto .Unmarshal (outctx .PreviousOutcome , prior ); err != nil {
182- return nil , err
183- }
184-
185176 currentShardHealth , allWorkflows , nows , wantShardVotes := p .collectShardInfo (aos )
186177 p .lggr .Infow ("RingOCR Outcome collect shard info" , "currentShardHealth" , currentShardHealth , "wantShardVotes" , wantShardVotes )
187178
@@ -202,6 +193,15 @@ func (p *Plugin) Outcome(_ context.Context, outctx ocr3types.OutcomeContext, _ t
202193 slices .Sort (votes )
203194 wantShards := votes [len (votes )/ 2 ]
204195
196+ // Bootstrap from Arbiter's current shard count on 1st round; subsequent rounds build on prior outcome
197+ prior := & pb.Outcome {}
198+ if outctx .PreviousOutcome == nil {
199+ prior .Routes = map [string ]* pb.WorkflowRoute {}
200+ prior .State = & pb.RoutingState {Id : outctx .SeqNr , State : & pb.RoutingState_RoutableShards {RoutableShards : wantShards }}
201+ } else if err := proto .Unmarshal (outctx .PreviousOutcome , prior ); err != nil {
202+ return nil , err
203+ }
204+
205205 allWorkflows = uniqueSorted (allWorkflows )
206206
207207 healthyShards := p .getHealthyShards (currentShardHealth )
0 commit comments