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

Refactoring threading #346

Closed
koenedaele opened this issue Sep 12, 2016 · 3 comments
Closed

Refactoring threading #346

koenedaele opened this issue Sep 12, 2016 · 3 comments

Comments

@koenedaele
Copy link
Member

We are running into issues because we're using providers in non thread-safe ways. Problem manifests itself most with skosprovider_sqlalchemy ( #343 ), but can happen with other providers that do anything more than a simple in memory provider.

After some discussion, the solution would be something like this:

  • Currently we're registering providers with a registry. We should also be able to register a provider_factory. This factory would be called by the registry whenever someone actually gets a provider. We could also make it so that we always need to register a factory or have some kind of default provider factory that always return the passed provider.
  • When starting a new thread, the factory should get access to the pyramid reqest in some way so it can get a db session.
  • These db session is currently created within atramhasis.db.data_managers. It should also just be available as request.db.
  • The factory creates a provider with everything it needs. It either creates a new one or copies an existing one, but it does not return one that already exists. At the end of a request, the provider is lost and all open sessions are closed.
@koenedaele
Copy link
Member Author

@koenedaele koenedaele added this to the Sprint 63 milestone Sep 4, 2017
@kmillet kmillet modified the milestones: Sprint 63, Sprint 64 Sep 19, 2017
@kmillet kmillet modified the milestones: Sprint 64, Sprint 65 Oct 2, 2017
@cecemel
Copy link

cecemel commented Oct 10, 2017

This issue seems to be dragged along for three sprints now. Is there anyone available this sprint who could work on it (within a reasonable time frame)? Else, I would suggest to leave it out of the sprint.

@cedrikv cedrikv removed this from the Sprint 65 milestone Oct 16, 2017
@koenedaele
Copy link
Member Author

Fixed by #491

Fixed in production before that by running the application single threaded.

@koenedaele koenedaele added this to the Sprint 128 milestone Apr 27, 2020
@koenedaele koenedaele self-assigned this Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants