Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear dex memstate cache #788

Merged
merged 3 commits into from
May 20, 2023
Merged

Clear dex memstate cache #788

merged 3 commits into from
May 20, 2023

Conversation

BrandonWeng
Copy link
Contributor

@BrandonWeng BrandonWeng commented May 20, 2023

Describe your changes and provide context

We need to clear the dex memcache

Testing performed to validate your change

@@ -23,7 +23,7 @@ type MemState struct {
}

func NewMemState(storeKey sdk.StoreKey) *MemState {
contractsToProcess := datastructures.NewSyncSet[string]([]string{})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not needed

@BrandonWeng BrandonWeng changed the title Clear memstate cache Clear dex memstate cache May 20, 2023
@@ -1207,6 +1208,9 @@ func (app *App) ProcessTxs(
// Clear the memcache context from the previous state as it failed, we no longer need to commit the data
ctx.ContextMemCache().Clear()

oldDexMemStateCtx := context.WithValue(ctx.Context(), dexutils.DexMemStateContextKey, oldDexMemState)
Copy link
Collaborator

Choose a reason for hiding this comment

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

memstate has deep pointers so we need to explicitly clear it like

dexMemState := dexutils.GetMemState(ctx.Context())
dexMemState.Clear(ctx)
dexMemState.ClearContractToDependencies()

@BrandonWeng BrandonWeng enabled auto-merge (squash) May 20, 2023 04:50
@BrandonWeng BrandonWeng merged commit 98c60f0 into master May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants