Skip to content

Commit

Permalink
fix: caching issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Nov 10, 2024
1 parent 2646de4 commit 475e6d2
Show file tree
Hide file tree
Showing 23 changed files with 449 additions and 261 deletions.
6 changes: 3 additions & 3 deletions cmd/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type GetCustomVaults func(c *gin.Context) []vaults.TRotkiVaults

func CacheSimplifiedVaults(cachingStore *cache.Cache, expire time.Duration, handle GetSimplifiedVaults) gin.HandlerFunc {
return func(c *gin.Context) {
if result, found := cachingStore.Get(c.Request.URL.String()); found {
if result, found := cachingStore.Get(c.Request.URL.String()); found && result != nil && len(result.([]vaults.TSimplifiedExternalVault)) > 0 {
c.JSON(http.StatusOK, result)
} else {
result := handle(c)
Expand All @@ -27,7 +27,7 @@ func CacheSimplifiedVaults(cachingStore *cache.Cache, expire time.Duration, hand

func CacheLegacyVaults(cachingStore *cache.Cache, expire time.Duration, handle GetLegacyExternalVaults) gin.HandlerFunc {
return func(c *gin.Context) {
if result, found := cachingStore.Get(c.Request.URL.String()); found {
if result, found := cachingStore.Get(c.Request.URL.String()); found && result != nil && len(result.([]vaults.TExternalVault)) > 0 {
c.JSON(http.StatusOK, result)
} else {
result := handle(c)
Expand All @@ -39,7 +39,7 @@ func CacheLegacyVaults(cachingStore *cache.Cache, expire time.Duration, handle G

func CacheCustomVaults(cachingStore *cache.Cache, expire time.Duration, handle GetCustomVaults) gin.HandlerFunc {
return func(c *gin.Context) {
if result, found := cachingStore.Get(c.Request.URL.String()); found {
if result, found := cachingStore.Get(c.Request.URL.String()); found && result != nil && len(result.([]vaults.TRotkiVaults)) > 0 {
c.JSON(http.StatusOK, result)
} else {
result := handle(c)
Expand Down
26 changes: 26 additions & 0 deletions data/meta/registries/42161.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@
"chainID": 42161,
"blockNumber": 11987182
},
"0x232c7a26e0bb7b7922b291ebbd111570827a99f0": {
"address": "0x232c7a26e0bb7b7922b291ebbd111570827a99f0",
"registryAddress": "0x8020fb37b21e0ef1707ada7a914baf44f9045e52",
"tokenAddress": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
"type": "Single Strategy",
"kind": "Single Strategy",
"extraProperties": {
"yieldVaultAddress": "0xd3443ee1e91aF28e5FB858Fbd0D72A63bA8046E0"
},
"version": "~3.0.2",
"chainID": 42161,
"blockNumber": 20693634
},
"0x239e14a19dff93a17339dcc444f74406c17f8e67": {
"address": "0x239e14a19dff93a17339dcc444f74406c17f8e67",
"registryAddress": "0x3199437193625dccd6f9c9e98bdf93582200eb1f",
Expand Down Expand Up @@ -302,6 +315,19 @@
"chainID": 42161,
"blockNumber": 199266154
},
"0xb2c12a6c665bb8383b1ec21da115015e0763d4df": {
"address": "0xb2c12a6c665bb8383b1ec21da115015e0763d4df",
"registryAddress": "0x8020fb37b21e0ef1707ada7a914baf44f9045e52",
"tokenAddress": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
"type": "Single Strategy",
"kind": "Single Strategy",
"extraProperties": {
"yieldVaultAddress": "0xd3443ee1e91aF28e5FB858Fbd0D72A63bA8046E0"
},
"version": "~3.0.2",
"chainID": 42161,
"blockNumber": 20693634
},
"0xc0ba9bfed28ab46da48d2b69316a3838698ef3f5": {
"address": "0xc0ba9bfed28ab46da48d2b69316a3838698ef3f5",
"registryAddress": "0xff31a1b020c868f6ea3f61eb953344920eeca3af",
Expand Down
6 changes: 3 additions & 3 deletions data/meta/strategies/1.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"lastUpdate": "2024-11-10T10:48:32.686316+01:00",
"lastUpdate": "2024-11-10T11:07:08.200846+01:00",
"version": {
"major": 0,
"minor": 3,
"patch": 6
"patch": 87
},
"shouldRefresh": false,
"strategies": {
Expand Down Expand Up @@ -26373,7 +26373,7 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "44675055418709361931531006",
"lastTotalDebt": "44677825785839173855597653",
"lastTotalLoss": "0",
"lastTotalGain": "1123305542539830424482856",
"lastPerformanceFee": "0",
Expand Down
60 changes: 30 additions & 30 deletions data/meta/strategies/10.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"lastUpdate": "2024-11-08T16:21:43.018308+01:00",
"lastUpdate": "2024-11-10T11:07:04.050924+01:00",
"version": {
"major": 0,
"minor": 10,
"patch": 17
"patch": 37
},
"shouldRefresh": false,
"strategies": {
Expand All @@ -20,11 +20,11 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "299662015216751997790",
"lastTotalDebt": "299748964086247871358",
"lastTotalLoss": "0",
"lastTotalGain": "58135651172056799759",
"lastTotalGain": "58223480656156267850",
"lastPerformanceFee": "0",
"lastReport": "1731070703",
"lastReport": "1731160497",
"lastDebtRatio": "10000",
"isRetired": false,
"displayName": "Velodrome Reinvest",
Expand Down Expand Up @@ -96,11 +96,11 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "1939385380004924347049",
"lastTotalDebt": "1939722081545466968877",
"lastTotalLoss": "0",
"lastTotalGain": "248529493094915966444",
"lastTotalGain": "248847794627893911849",
"lastPerformanceFee": "0",
"lastReport": "1731024279",
"lastReport": "1731111517",
"lastDebtRatio": "10000",
"isRetired": false,
"displayName": "Velodrome Reinvest",
Expand Down Expand Up @@ -760,11 +760,11 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "1038074769879990827",
"lastTotalDebt": "1040085648622116513",
"lastTotalLoss": "0",
"lastTotalGain": "1966985339915521703",
"lastTotalGain": "1967995149809889659",
"lastPerformanceFee": "0",
"lastReport": "1728737501",
"lastReport": "1731160489",
"lastDebtRatio": "10000",
"isRetired": false,
"displayName": "Velodrome Reinvest",
Expand Down Expand Up @@ -1094,11 +1094,11 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "2341303454523887873",
"lastTotalDebt": "2341906209546224300",
"lastTotalLoss": "0",
"lastTotalGain": "142941920827831418",
"lastTotalGain": "143516611466107215",
"lastPerformanceFee": "0",
"lastReport": "1731070733",
"lastReport": "1731160513",
"lastDebtRatio": "10000",
"isRetired": false,
"displayName": "",
Expand Down Expand Up @@ -1350,8 +1350,8 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "192057031526629381454975",
"lastTotalLoss": "232",
"lastTotalDebt": "192021653184128806441177",
"lastTotalLoss": "245",
"lastTotalGain": "24472525185496550185",
"lastPerformanceFee": "0",
"lastReport": "1730634737",
Expand Down Expand Up @@ -1452,11 +1452,11 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "134373119808778432041",
"lastTotalDebt": "134464614704599913536",
"lastTotalLoss": "0",
"lastTotalGain": "52883216842257752592",
"lastTotalGain": "53007280875791897167",
"lastPerformanceFee": "0",
"lastReport": "1730500907",
"lastReport": "1731111651",
"lastDebtRatio": "10000",
"isRetired": false,
"displayName": "Velodrome Reinvest",
Expand Down Expand Up @@ -2420,11 +2420,11 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "0",
"lastTotalDebt": "123089197487831775",
"lastTotalLoss": "0",
"lastTotalGain": "0",
"lastPerformanceFee": "0",
"lastReport": "1729120967",
"lastReport": "1731111759",
"lastDebtRatio": "10000",
"isRetired": true,
"displayName": "",
Expand Down Expand Up @@ -2496,11 +2496,11 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "45991923579486626394778",
"lastTotalDebt": "46149073877303105089075",
"lastTotalLoss": "0",
"lastTotalGain": "52097907295733485203442",
"lastTotalGain": "52258998900370894654362",
"lastPerformanceFee": "0",
"lastReport": "1731070713",
"lastReport": "1731160507",
"lastDebtRatio": "10000",
"isRetired": false,
"displayName": "Velodrome Reinvest",
Expand Down Expand Up @@ -2728,11 +2728,11 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "94864312948989089959273",
"lastTotalDebt": "95219925813766061172297",
"lastTotalLoss": "0",
"lastTotalGain": "104182048379624784160387",
"lastTotalGain": "104546979059409965115281",
"lastPerformanceFee": "0",
"lastReport": "1731070697",
"lastReport": "1731160477",
"lastDebtRatio": "10000",
"isRetired": false,
"displayName": "Velodrome Reinvest",
Expand Down Expand Up @@ -2936,11 +2936,11 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "1142386535798526",
"lastTotalDebt": "1146659325247379",
"lastTotalLoss": "0",
"lastTotalGain": "7489340405907848",
"lastTotalGain": "7493352681614996",
"lastPerformanceFee": "0",
"lastReport": "1729820511",
"lastReport": "1731160483",
"lastDebtRatio": "10000",
"isRetired": false,
"displayName": "Velodrome Reinvest",
Expand Down
6 changes: 3 additions & 3 deletions data/meta/strategies/100.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"lastUpdate": "2024-11-08T16:21:22.720283+01:00",
"lastUpdate": "2024-11-10T11:06:46.692025+01:00",
"version": {
"major": 0,
"minor": 3,
"patch": 26
"patch": 31
},
"shouldRefresh": false,
"strategies": {
Expand All @@ -24,7 +24,7 @@
"lastTotalLoss": "0",
"lastTotalGain": "0",
"lastPerformanceFee": "1000",
"lastReport": "1731010915",
"lastReport": "1731184105",
"lastDebtRatio": "10000",
"isRetired": true,
"displayName": "",
Expand Down
4 changes: 2 additions & 2 deletions data/meta/strategies/137.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"lastUpdate": "2024-11-10T10:49:47.003592+01:00",
"lastUpdate": "2024-11-10T11:06:51.497088+01:00",
"version": {
"major": 0,
"minor": 11,
"patch": 283
"patch": 440
},
"shouldRefresh": false,
"strategies": {
Expand Down
6 changes: 3 additions & 3 deletions data/meta/strategies/250.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"lastUpdate": "2024-11-08T16:21:23.775058+01:00",
"lastUpdate": "2024-11-10T11:06:47.041964+01:00",
"version": {
"major": 0,
"minor": 3,
"patch": 52
"patch": 57
},
"shouldRefresh": false,
"strategies": {
Expand Down Expand Up @@ -1095,7 +1095,7 @@
"keepCRV": null,
"keepCRVPercent": null,
"keepCVX": null,
"lastTotalDebt": "82001892720211234233305",
"lastTotalDebt": "82000645286457266553631",
"lastTotalLoss": "0",
"lastTotalGain": "40948193788906764933274",
"lastPerformanceFee": "0",
Expand Down
Loading

0 comments on commit 475e6d2

Please sign in to comment.