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

Deobfuscate scalems.store.FileStore lifetime management. #324

Open
eirrgang opened this issue Mar 29, 2023 · 0 comments
Open

Deobfuscate scalems.store.FileStore lifetime management. #324

eirrgang opened this issue Mar 29, 2023 · 0 comments

Comments

@eirrgang
Copy link
Contributor

scalems.store makes "clever" use of the Python generator protocol to place the main owning reference to the FileStore in the frame of a generator function.

This is done for various reasons that seem insufficient justification for the obscurity of the implementation. (Namely, a generator instance seemed like kind of a handy relocatable context manager that allowed for a finally block.)

We can probably improve readability, maintainability, and simplicity by using a __del__ method or a finalizer callback (ref: the weakref module).

This becomes more relevant as the FileStoreManager gains responsibilities beyond managing that single generator.

There may be other reasons for the original design decision, though, and I don't want to open a fresh can of worms just yet, so this issue is deferred until after the "raptor migration" iteration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant