Further improve locking (Atomic) by zeripath · Pull Request #91 · unrolled/render · GitHub
Skip to content

Further improve locking (Atomic)#91

Closed
zeripath wants to merge 2 commits into
unrolled:v1from
zeripath:use-atomic
Closed

Further improve locking (Atomic)#91
zeripath wants to merge 2 commits into
unrolled:v1from
zeripath:use-atomic

Conversation

@zeripath

@zeripath zeripath commented May 12, 2021

Copy link
Copy Markdown
Contributor

As a second step improving #90, switch from using a RWMutex to use an
atomic.Value and a reconstruct functions to ensure that the current
templates are referenced in the helper func instead of a global
reference.

Close #92

Signed-off-by: Andrew Thornton art27@cantab.net

zeripath added 2 commits May 12, 2021 09:13
As a second step improving unrolled#90, switch from using a RWMutex to use an
atomic.Value and a reconstruct functions to ensure that the current
templates are referenced in the helper func instead of a global
reference.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath

Copy link
Copy Markdown
Contributor Author

zeripath added a commit to zeripath/render that referenced this pull request May 12, 2021
As a second step improving unrolled#90, only lock when absolutely necessary
and reconstruct functions to ensure that the current templates are
referenced in the helper func instead of a global reference.

Closes unrolled#91

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath mentioned this pull request May 12, 2021
@zeripath zeripath changed the title Further improve locking Further improve locking (Atomic) May 12, 2021
@zeripath

Copy link
Copy Markdown
Contributor Author

@zeripath zeripath closed this May 12, 2021
@zeripath zeripath deleted the use-atomic branch May 12, 2021 19:25
unrolled pushed a commit that referenced this pull request May 26, 2021
* Further improve locking (RWMutex version)

As a second step improving #90, only lock when absolutely necessary
and reconstruct functions to ensure that the current templates are
referenced in the helper func instead of a global reference.

Closes #91

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Use fsnotify if using Directory and expose CompileTemplates

If setting IsDevelopment, if we can, use an FsWatcher to recompile the
templates in a separate goroutine. This should definitely increase the
performance of the Development server.

In order to make Asset based Renders have the same improvement - now
that render compilation properly locks the templates we can expose the
CompileTemplates function and allow downstream users to call this
independently when their templates need recompilation.

Contains #92

Signed-off-by: Andrew Thornton <art27@cantab.net>
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.

1 participant