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

Atomic cache writing. #1186

Merged
merged 1 commit into from May 25, 2020
Merged

Atomic cache writing. #1186

merged 1 commit into from May 25, 2020

Conversation

PATROMO
Copy link
Contributor

@PATROMO PATROMO commented Mar 24, 2020

Two parallel running processes writing the cache run into an error.

  1. file_put_contents() is binary-safe and FontCache should use write() from Cache.php
  2. file_put_contents() is not atomic. Therefore a different technique should be used. Write temp and then use rename().

@PATROMO
Copy link
Contributor Author

PATROMO commented May 18, 2020

@finwe can you please review this pr?

@finwe
Copy link
Member

finwe commented May 18, 2020

Seems OK. Please, add a changelog entry, rebase on current development, squash commits into one and forcepush to the original branch. I'll be then happy to merge this.

Create a temp file, write the content and finally rename the file to the destination.
Because several concurrent processes accessing the cache are running into an error.
@PATROMO
Copy link
Contributor Author

PATROMO commented May 25, 2020

@finwe done.

@finwe finwe merged commit 10bc24b into mpdf:development May 25, 2020
@PATROMO PATROMO deleted the eb/atomic-cache-writing branch May 25, 2020 09:03
@PATROMO
Copy link
Contributor Author

PATROMO commented May 25, 2020

@finwe thanks. Is it possible to publish a new release? :)

@finwe
Copy link
Member

finwe commented May 25, 2020

https://github.com/mpdf/mpdf/releases/tag/v8.0.6

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

Successfully merging this pull request may close these issues.

None yet

2 participants