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

project.close() race condition #407

Open
gmaclennan opened this issue Dec 7, 2023 · 0 comments
Open

project.close() race condition #407

gmaclennan opened this issue Dec 7, 2023 · 0 comments
Labels
post-mvp de-scoped to after MVP

Comments

@gmaclennan
Copy link
Member

Description

Non-urgent follow-up to #375.

With the currently implementation it's possible to hit a race condition while closing a project:

const closePromise = project.close() // Note: no await
const project = manager.getProject(projectId)
await closePromise()
await project.observation.getMany() // will fail because project is closed

Needs proper state management to fix: e.g. project.state: 'opening' | 'opened' | 'closing' | 'closed'. Then maybe rather than events based doing in getProject():

getProject(projectId) {
  const activeProject = this.#activeProjects.get(projectPublicId)
    if (activeProject && activeProject.state !== 'closed' && activeProject.state !== 'closing') return activeProject

This is fine to not address as a priority - we only close projects in tests. Just leaving this here in case we run into this issue in tests in the future.

@EvanHahn EvanHahn added the post-mvp de-scoped to after MVP label Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
post-mvp de-scoped to after MVP
Projects
None yet
Development

No branches or pull requests

2 participants