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

11.2 poolboy implementation no longer uses phash2 #30

Open
tisdall opened this issue Oct 8, 2024 · 1 comment
Open

11.2 poolboy implementation no longer uses phash2 #30

tisdall opened this issue Oct 8, 2024 · 1 comment

Comments

@tisdall
Copy link

tisdall commented Oct 8, 2024

My understanding of the earlier Todo.Database.choose_worker/1 was to ensure only 1 worker ever touched a database file at a time (ie avoid collisions writing to the files). In 11.2 the database components are altered to have a pool of 3 workers, but there's no longer anything preventing file collisions.

The point of the exercise was to switch over to using a dependency, but I was wondering if my assertions above are correct or if I missed something.

(BTW, this book is really good and I appreciate the github repo with full examples!)

@sasa1977
Copy link
Owner

sasa1977 commented Oct 9, 2024

Yes, you're spot on! It doesn't matter in the grand scheme of things, because all the operations are channeled through the todo genservers, which ensures we won't be touching the same file from different db workers.

TBH, I picked hashing in the first implementation primarily because it's much simpler to implement than the poolboy version which requires tracking idle vs busy workers, and so it would be a much more demanding exercise.

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

No branches or pull requests

2 participants