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

[atom.xml] Add rel and type to site link #2276

Closed
wants to merge 22 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8d16d17
Next version
Keats Mar 19, 2023
b00ae42
print error message when no config file found (#2168)
iEverX Apr 6, 2023
1ed722c
Speedup "zola check" command by reusing the Client (#2171)
MTRNord Apr 6, 2023
6a5c241
Implement replace_re filter (#2163)
cydave Apr 20, 2023
c48b61a
templates: add base URL for feed content (#2190)
jk-ozlabs Apr 23, 2023
7edf92b
Fix multi-lingual json index (#2197)
Jieiku Apr 28, 2023
7448309
Add search.index_format into the serialized config (#2165) (#2196)
Raymi306 May 1, 2023
4f77980
Fix typo in error message
Keats May 2, 2023
1321a83
Hard link serve panic fix (#2210)
Raymi306 May 6, 2023
b5a90db
Add support for lazy loading images (#2211)
sinofp May 6, 2023
1778707
Prevent spans crossing line boundaries in class-based code block form…
TheOnlyMrCat Jul 10, 2023
afc0e2c
always sort assets by filename (Windows/Linux difference) (#2236)
wold5 Jul 10, 2023
66f5bf5
Atom template authors (#2259)
heitorPB Jul 26, 2023
f962370
Add attributes to base_url link in atom template (#2261)
savq Jul 27, 2023
d3793cd
Fixes #2250; Error instead of panic when root directory or config fil…
Raymi306 Jul 30, 2023
fe1967f
Fix LFI in `zola serve` (#2258)
adeadfed Aug 4, 2023
b97a1d5
Update changelog
Keats Aug 4, 2023
f0b984d
Update edition
Keats Aug 4, 2023
57968be
Update deps
Keats Aug 4, 2023
c4341b1
Add ignored_static to config (#2209)
Raymi306 Aug 13, 2023
4474afa
template:feeds: add extra block (#2263)
heitorPB Aug 13, 2023
5f13e77
[atom.xml] Add rel and type to site link
ptxmac Aug 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Speedup "zola check" command by reusing the Client (#2171)
* Reuse Client when checking urls and add timeout for requests
  • Loading branch information
MTRNord authored Apr 6, 2023
commit 1ed722c076e801c7ec3d62209d40315b4353b811
13 changes: 8 additions & 5 deletions components/link_checker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ pub fn message(res: &Result) -> String {
// Keep history of link checks so a rebuild doesn't have to check again
static LINKS: Lazy<Arc<RwLock<HashMap<String, Result>>>> =
Lazy::new(|| Arc::new(RwLock::new(HashMap::new())));
// Make sure to create only a single Client so that we can reuse the connections
static CLIENT: Lazy<Client> = Lazy::new(|| {
Client::builder()
.user_agent(concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")))
.build()
.expect("reqwest client build")
});

pub fn check_url(url: &str, config: &LinkChecker) -> Result {
{
Expand All @@ -44,15 +51,11 @@ pub fn check_url(url: &str, config: &LinkChecker) -> Result {
headers.append(ACCEPT, "*/*".parse().unwrap());

// TODO: pass the client to the check_url, do not pass the config
let client = Client::builder()
.user_agent(concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")))
.build()
.expect("reqwest client build");

let check_anchor = !config.skip_anchor_prefixes.iter().any(|prefix| url.starts_with(prefix));

// Need to actually do the link checking
let res = match client.get(url).headers(headers).send() {
let res = match CLIENT.get(url).headers(headers).send() {
Ok(ref mut response) if check_anchor && has_anchor(url) => {
let body = {
let mut buf: Vec<u8> = vec![];
Expand Down