Indexer: a seed's registration write ends no proposal key (an empty key stopped the seed after its first module); the history fill is read within a second and its failure said
This commit is contained in:
@@ -59,12 +59,19 @@ func newRegistry(js jetstream.JetStream, conn *nats.Conn, cred process.Account,
|
||||
}
|
||||
_, err = js.Publish(ctx, historySubject(cred.Module, r.Module), data, jetstream.WithMsgID(fmt.Sprintf("%s.%d", r.Module, r.Version)))
|
||||
if err == nil {
|
||||
// Past 80 % full the stream's fill is a finding (design 47 G §704).
|
||||
if st, serr := js.Stream(ctx, catalogue.StreamBusName(index.RegistrationHistoryStream)); serr == nil {
|
||||
if info, ierr := st.Info(ctx); ierr == nil {
|
||||
// Past 80 % full the stream's fill is a finding (design 47 G §704); read within a second, and said when it cannot be.
|
||||
fctx, cancel := context.WithTimeout(ctx, time.Second)
|
||||
st, serr := js.Stream(fctx, catalogue.StreamBusName(index.RegistrationHistoryStream))
|
||||
if serr == nil {
|
||||
var info *jetstream.StreamInfo
|
||||
if info, serr = st.Info(fctx); serr == nil {
|
||||
ix.HistoryFill(ctx, int64(info.State.Bytes), info.Config.MaxBytes)
|
||||
}
|
||||
}
|
||||
cancel()
|
||||
if serr != nil {
|
||||
logf("the fill of %s is not read, so its finding is not judged: %v", index.RegistrationHistoryStream, serr)
|
||||
}
|
||||
}
|
||||
return err
|
||||
},
|
||||
|
||||
@@ -838,6 +838,9 @@ func (r *Registry) write(ctx context.Context, key string, p Proposal, next meshc
|
||||
r.logf("the builds of %s on the branches it no longer watches are not pruned: %v", next.Module, err)
|
||||
}
|
||||
}
|
||||
if key == "" {
|
||||
return nil // a write of the seed's: no proposal key of its own to end
|
||||
}
|
||||
return r.endKey(ctx, key, p, ProposalApplied, fmt.Sprintf("applied as version %d of %s on %s", next.Version, next.Module, occ.Says(w)))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user