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

Fix the memory leak in the backend #1566

Open
dysbulic opened this issue Jun 2, 2023 · 0 comments
Open

Fix the memory leak in the backend #1566

dysbulic opened this issue Jun 2, 2023 · 0 comments
Labels
backend Backend related issues bug Something isn't working medium Medium Priority refactor Issues for opportunities to refactor parts of the codebase

Comments

@dysbulic
Copy link
Member

dysbulic commented Jun 2, 2023

What happened?

I'm pretty sure this code is leaking memory and causing the backend process on Render to intermittently die.

It is there because when a user is first connecting there are several near simultaneous calls to useUser that trigger the creation of several users with the same information. All but the first of these will fail because of a uniqueness constraint on the Ethereum address. This code polls to see if a user is currently being created & sleeps if that is going on.

This logic could be replaced with Promises. After a Promise returns, all subsequent awaits of that Promise will return the resolved value directly.

What did you expect to happen?

Not to be getting daily messages that the backend has died.

How can we reproduce the problem (as minimally as possible)?

Monitor sage@metagame.wtf's email and note the messages that the backend service has failed.

@dysbulic dysbulic added bug Something isn't working backend Backend related issues medium Medium Priority refactor Issues for opportunities to refactor parts of the codebase labels Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend related issues bug Something isn't working medium Medium Priority refactor Issues for opportunities to refactor parts of the codebase
Projects
None yet
Development

No branches or pull requests

1 participant