Skip to content

Commit

Permalink
try to not delete next query
Browse files Browse the repository at this point in the history
  • Loading branch information
lukedirtwalker committed Oct 11, 2019
1 parent b59de29 commit 6d38438
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
28 changes: 14 additions & 14 deletions go/lib/infra/modules/segfetcher/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ func (f *Fetcher) FetchSegs(ctx context.Context, req Request) (Segments, error)
return Segments{}, err
}
var segs Segments
i := 0
for {
for i := 0; i < 3; i++ {
log.FromCtx(ctx).Trace("Request to process",
"req", reqSet, "segs", segs, "iteration", i+1)
segs, reqSet, err = f.Resolver.Resolve(ctx, segs, reqSet)
Expand All @@ -126,7 +125,8 @@ func (f *Fetcher) FetchSegs(ctx context.Context, req Request) (Segments, error)
if reqSet.IsEmpty() {
break
}
if i > 3 {
// in 3 iteration (i==2) everything should be resolved.
if i >= 2 {
log.FromCtx(ctx).Error("No convergence in lookup", "iteration", i+1)
return segs, common.NewBasicError("Segment lookup doesn't converge", nil,
"iterations", i+1)
Expand Down Expand Up @@ -163,17 +163,17 @@ func (f *Fetcher) waitOnProcessed(ctx context.Context, replies <-chan ReplyOrErr
if err := r.Err(); err != nil {
return err
}
for _, rev := range r.Stats().VerifiedRevs {
revInfo, err := rev.RevInfo()
if err != nil {
logger.Warn("Failed to extract rev info from verified rev",
"err", err, "rev", rev)
continue
}
// TODO(lukedirtwalker): collect all revInfos and delete only
// once.
f.NextQueryCleaner.ResetQueryCache(ctx, revInfo)
}
// for _, rev := range r.Stats().VerifiedRevs {
// revInfo, err := rev.RevInfo()
// if err != nil {
// logger.Warn("Failed to extract rev info from verified rev",
// "err", err, "rev", rev)
// continue
// }
// // TODO(lukedirtwalker): collect all revInfos and delete only
// // once.
// f.NextQueryCleaner.ResetQueryCache(ctx, revInfo)
// }
nextQuery := f.nextQuery(r.Stats().VerifiedSegs)
_, err := f.PathDB.InsertNextQuery(ctx, reply.Req.Src, reply.Req.Dst, nil, nextQuery)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions go/path_srv/internal/handlers/segrevoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ func (h *revocHandler) Handle() *infra.HandlerResult {
sendAck(proto.Ack_ErrCode_reject, messenger.AckRejectFailedToVerify)
return infra.MetricsErrInvalid
}
if err := h.NextQueryCleaner.ResetQueryCache(ctx, revInfo); err != nil {
logger.Warn("Couldn't reset pathdb cache for revocation", "err", err)
}
// if err := h.NextQueryCleaner.ResetQueryCache(ctx, revInfo); err != nil {
// logger.Warn("Couldn't reset pathdb cache for revocation", "err", err)
// }

_, err = h.revCache.Insert(ctx, revocation)
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions go/sciond/internal/servers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ func (h *RevNotificationHandler) Handle(ctx context.Context, conn net.PacketConn
switch {
case isValid(err):
revReply.Result = sciond.RevValid
revInfo, err := revNotification.SRevInfo.RevInfo()
if err != nil {
logger.Error("Failed to extract error from rev info", "err", err)
}
if err := h.NextQueryCleaner.ResetQueryCache(ctx, revInfo); err != nil {
logger.Error("Failed to delete query cache", "err", err)
}
// revInfo, err := revNotification.SRevInfo.RevInfo()
// if err != nil {
// logger.Error("Failed to extract error from rev info", "err", err)
// }
// if err := h.NextQueryCleaner.ResetQueryCache(ctx, revInfo); err != nil {
// logger.Error("Failed to delete query cache", "err", err)
// }
case isStale(err):
revReply.Result = sciond.RevStale
case isInvalid(err):
Expand Down

0 comments on commit 6d38438

Please sign in to comment.