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

semaphore / concurrency #54

Open
michielbdejong opened this issue Nov 24, 2021 · 3 comments
Open

semaphore / concurrency #54

michielbdejong opened this issue Nov 24, 2021 · 3 comments

Comments

@michielbdejong
Copy link
Member

php-solid-server is failing the new concurrency tests that were added in solid-crud-tests v5.1.0.

What these tests do is send 10 PUT requests for the same resource at the same time, with If-None-Match: * header.
This means only 1 of them should return a 201 and the other 9 should return 412 Precondition Failed.

Looking at the code, it does a has check first and then a write. Does FlySystem support something like an atomic WriteIfNotExists or something like Lock?

@michielbdejong
Copy link
Member Author

Hm, doesn't seem like it does - https://github.com/thephpleague/flysystem/search?q=atomic&type=issues

@Potherca
Copy link
Member

Potherca commented Nov 25, 2021

There is the ability to use locks with the Local adapter which is what we currently use.

That might cause problems later, if/when we ever decide to (also?) support other adapters, but for now it should not cause trouble...

Hmmm... It says "By default this adapter uses a lock during writes and updates", which means that's not what we're looking for.

@Potherca
Copy link
Member

Looks like we are still using FlySystem v1, which does seem to have a put method. In v2, this has been changed to deterministic writes. We might be able to change the logic as to not use has and allow FlySystem to handle the fallout? 🤔 Still feel like I'm missing something, though...

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

No branches or pull requests

2 participants