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

feat: promise timeout on lock #5108

Merged
merged 2 commits into from
Oct 20, 2023
Merged

feat: promise timeout on lock #5108

merged 2 commits into from
Oct 20, 2023

Conversation

kwasniew
Copy link
Contributor

@kwasniew kwasniew commented Oct 20, 2023

About the changes

  • Adding Promise timeout in DB lock. Once the lock is acquired the function that we're locking (e.g. DB migration) has 60 seconds (default value) to do its job. After the timeout elapsed we unlock the lock.
  • This change may also remove some flakiness in the tests since I noticed that the previous incorrect implementation of the timeout did not close the client in the timeout test

Important files

Discussion points

Is 60 second enough for the DB migrations to run?
for now I increase it to 30 minutes to be on the safe side.

@vercel
Copy link

vercel bot commented Oct 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 20, 2023 9:33am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Oct 20, 2023 9:33am

Copy link
Contributor

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

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

This changes db-lock for production, not only for test. I believe (correct me if I'm wrong) that db-lock is only used during migration process, not at runtime.

@kwasniew
Copy link
Contributor Author

@gastonfournier It will affect the production because previously the timeout didn't work. Now it will time out after 60 seconds.

@kwasniew kwasniew changed the title feat: promsie timeout feat: promise timeout on lock Oct 20, 2023
@gastonfournier
Copy link
Contributor

@gastonfournier It will affect the production because previously the timeout didn't work. Now it will time out after 60 seconds.

But only for the import, right? I'm worried that otherwise it may impact other read or write operations by increasing the timeout and perhaps causing a different issue. If it only applies to import, I think it's fine

@kwasniew kwasniew merged commit 433f3e2 into main Oct 20, 2023
10 of 14 checks passed
@kwasniew kwasniew deleted the db-lock-timeout branch October 20, 2023 10:10
@kwasniew
Copy link
Contributor Author

It's only for the DB migration, it's not related to import or any other API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants