Skip to content

Commit

Permalink
overwrite cache
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Mar 7, 2024
1 parent 02c32f5 commit fbb55c2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/sqs_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var DefaultConfig = domain.Config{
MaxSplitIterations: 10,
MinOSMOLiquidity: 10000, // 10_000 OSMO
RouteCacheEnabled: false,
RouteCacheExpirySeconds: 600, // 10 minutes
RouteCacheExpirySeconds: 1200, // 20 minutes

EnableOverwriteRoutesCache: false,
},
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"max-split-iterations": 10,
"min-osmo-liquidity": 100,
"route-cache-enabled": true,
"route-cache-expiry-seconds": 600
"route-cache-expiry-seconds": 1200
},
"pools": {
"transmuter-code-ids": [148, 254],
Expand Down
9 changes: 1 addition & 8 deletions router/usecase/router_usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,6 @@ func (r *routerUseCaseImpl) GetOptimalQuoteFromConfig(ctx context.Context, token
return nil, err
}

for _, route := range candidateRoutes.Routes {
r.logger.Debug("filtered_candidate_route", zap.Any("route", route))
}

// Rank candidate routes by estimating direct quotes
topSingleRouteQuote, rankedRoutes, err = r.rankRoutesByDirectQuote(ctx, router, candidateRoutes, tokenIn, tokenOutDenom)
if err != nil {
Expand All @@ -203,7 +199,7 @@ func (r *routerUseCaseImpl) GetOptimalQuoteFromConfig(ctx context.Context, token
candidateRoutes = convertRankedToCandidateRoutes(rankedRoutes)

// TODO move cache value to config.
r.rankedRouteCache.Set(formatRankedRouteCacheKey(tokenIn.Denom, tokenOutDenom, tokenInOrderOfMagnitude), candidateRoutes, time.Minute*5)
r.rankedRouteCache.Set(formatRankedRouteCacheKey(tokenIn.Denom, tokenOutDenom, tokenInOrderOfMagnitude), candidateRoutes, time.Minute*10)
}
}

Expand All @@ -229,9 +225,6 @@ func (r *routerUseCaseImpl) GetOptimalQuoteFromConfig(ctx context.Context, token
routes := topSplitQuote.GetRoute()

r.logger.Debug("split route selected", zap.Int("route_count", len(routes)))
for _, route := range routes {
r.logger.Debug("route", zap.Stringer("route", route))
}

finalQuote = topSplitQuote
}
Expand Down

0 comments on commit fbb55c2

Please sign in to comment.