mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-23 23:21:00 +01:00
Fixed race condition in privacy plugin
This commit is contained in:
parent
39d14d5c19
commit
92089c67f1
@ -96,11 +96,9 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]):
|
||||
# automatically loads Mermaid.js when a Mermaid diagram is
|
||||
# found in the page - https://bit.ly/36tZXsA.
|
||||
if "mermaid.min.js" in url.path and not config.site_url:
|
||||
path = url.geturl()
|
||||
if path not in config.extra_javascript:
|
||||
config.extra_javascript.append(
|
||||
ExtraScriptValue(path)
|
||||
)
|
||||
script = ExtraScriptValue(url.geturl())
|
||||
if script not in config.extra_javascript:
|
||||
config.extra_javascript.append(script)
|
||||
|
||||
# The local asset references at least one external asset, which
|
||||
# means we must download and replace them later
|
||||
@ -149,6 +147,10 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]):
|
||||
if not self._is_excluded(url, page.file):
|
||||
self._queue(url, config, concurrent = True)
|
||||
|
||||
# Sync all concurrent jobs
|
||||
def on_env(self, env, *, config, files):
|
||||
wait(self.pool_jobs)
|
||||
|
||||
# Process external assets in template (run later)
|
||||
@event_priority(-50)
|
||||
def on_post_template(self, output_content, *, template_name, config):
|
||||
|
@ -96,11 +96,9 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]):
|
||||
# automatically loads Mermaid.js when a Mermaid diagram is
|
||||
# found in the page - https://bit.ly/36tZXsA.
|
||||
if "mermaid.min.js" in url.path and not config.site_url:
|
||||
path = url.geturl()
|
||||
if path not in config.extra_javascript:
|
||||
config.extra_javascript.append(
|
||||
ExtraScriptValue(path)
|
||||
)
|
||||
script = ExtraScriptValue(url.geturl())
|
||||
if script not in config.extra_javascript:
|
||||
config.extra_javascript.append(script)
|
||||
|
||||
# The local asset references at least one external asset, which
|
||||
# means we must download and replace them later
|
||||
@ -149,6 +147,10 @@ class PrivacyPlugin(BasePlugin[PrivacyConfig]):
|
||||
if not self._is_excluded(url, page.file):
|
||||
self._queue(url, config, concurrent = True)
|
||||
|
||||
# Sync all concurrent jobs
|
||||
def on_env(self, env, *, config, files):
|
||||
wait(self.pool_jobs)
|
||||
|
||||
# Process external assets in template (run later)
|
||||
@event_priority(-50)
|
||||
def on_post_template(self, output_content, *, template_name, config):
|
||||
|
Loading…
Reference in New Issue
Block a user