Skip to content

Commit

Permalink
fix: db sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Jun 20, 2023
1 parent e5ab23d commit c5223c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions common/store/store.setter.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ func StoreStrategies(chainID uint64, strat models.TStrategyAdded) {
}
}

/**************************************************************************************************
** AppendInStrategyMap will add a new vault in the _strategiesSyncMap
**************************************************************************************************/
func AppendInStrategyMap(chainID uint64, strat models.TStrategyAdded) {
syncMap := _strategiesSyncMap[chainID]
syncMap.Store(strat.StrategyAddress, strat)
}

/**************************************************************************************************
** StoreSyncRegistry will store the sync status indicating we went up to the block number to check
** for new vaults.
Expand Down
2 changes: 1 addition & 1 deletion external/vaults/route.vaults.one.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ func (y Controller) GetVault(c *gin.Context) {

vaultStrategies := strategies.ListStrategiesForVault(chainID, currentVault.Address)
newVault.Strategies = []*TStrategy{}

for _, strategy := range vaultStrategies {
var externalStrategy *TStrategy
strategyWithDetails := NewStrategy().AssignTStrategy(strategy)
if !strategyWithDetails.ShouldBeIncluded(strategiesCondition) {
// logs.Pretty(`SHOULD NOT BE INCLUDED`, strategyWithDetails)
continue
}

Expand Down
5 changes: 3 additions & 2 deletions internal/events/filterStrategyAdded.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func HandleStrategyAdded(
strategies[vaultAddressParsed][strategyAddressParsed] = valueParsed
valueParsed.ChainID = chainID
allStrategiesList = append(allStrategiesList, valueParsed)
go store.StoreStrategies(chainID, valueParsed)
store.StoreStrategies(chainID, valueParsed)
count++
return true
})
Expand Down Expand Up @@ -431,7 +431,7 @@ func HandleStrategyAdded(
newStrategy.VaultVersion = vaultsMap[vaultAddressParsed].APIVersion
strategies[vaultAddressParsed][newStrategyAddressParsed] = newStrategy
allStrategiesList = append(allStrategiesList, newStrategy)
go store.StoreStrategies(chainID, newStrategy)
store.StoreStrategies(chainID, newStrategy)
count++
return true
})
Expand All @@ -440,5 +440,6 @@ func HandleStrategyAdded(
allStrategiesList = append(allStrategiesList, strat)
}

logs.Info(`DONE HERE`)
return allStrategiesList
}

1 comment on commit c5223c4

@vercel
Copy link

@vercel vercel bot commented on c5223c4 Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ydaemon – ./docs

ydaemon.yearn.farm
ydaemon-git-main.yearn.farm

Please sign in to comment.