Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nightlinus
Copy link
Contributor

As of now compiled container can be broken when concurrently compile container.
This pr add saving compiled content to temporary file and then rename it to destination file.

@jdreesen
Copy link
Contributor

There's also a webimpress/safe-writer package (which is used by ocramius/proxy-manager since v2.6). Maybe it's worth a look.

@nightlinus
Copy link
Contributor Author

There's also a webimpress/safe-writer package (which is used by ocramius/proxy-manager since v2.6). Maybe it's worth a look.

Yep, can be done with package. @mnapoli i can rework it with package, what do you prefer?

@mnapoli
Copy link
Member

mnapoli commented Aug 23, 2020

Thanks for the responses. I don't think it's worth using an extra package, I'd rather keep dependencies as light as possible (proxy-manager is an optional dependency).

What you did looks good, let's merge that!

Thank you!

@mnapoli mnapoli merged commit 40140b5 into PHP-DI:master Aug 23, 2020
@holtkamp
Copy link
Contributor

holtkamp commented Aug 24, 2020

Nice contribution. I also encountered a broken CompiledContainer a few times.

Regarding #728 (comment), I would say it is worth the extra package/dependency because:

  1. this kind of functionality might introduce "strange" behavior, such as: Avoid writing to temporary dir? webimpress/safe-writer#2
  2. both ocramius/proxy-manager and php-di/php-di are used a lot, so sharing the this dependency only makes it more reliable, right and tested all over the world in different setups.
  3. the package itself does not have any additional dependencies: https://github.com/webimpress/safe-writer/blob/e185e55135c240dc5f490cae8ea3ae8051959db4/composer.json#L12-L14
  4. and maybe most important: it is well-tested: https://github.com/webimpress/safe-writer/tree/master/test

Just my two cents ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants