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

Site page stats counters on rebuilds #2211

Closed
g3wanghc opened this issue Jun 13, 2016 · 2 comments
Closed

Site page stats counters on rebuilds #2211

g3wanghc opened this issue Jun 13, 2016 · 2 comments
Assignees
Milestone

Comments

@g3wanghc
Copy link
Contributor

I've noticed something weird in replacePage on site.go.

func (s *Site) replacePage(page *Page) {
    // will find existing page that matches filepath and remove it
    s.removePage(page)
    s.addPage(page)
}

If the original page wasn't built, then it wouldn't be part of site.Pages.

If you've modified an unpublishedPage, replacePage will be called but removePage wouldn't do anything since it can't find it in site.Pages. addPage will be called and futureCount is increased by 1.

If you added a future publishDate to an existing Page in site.Pages, then removePage will decrease futureCount by -1, and addPage will increate futureCount by 1, resulting in a net gain of 0.

Therefore, Site stats after replacePage is called will always be wrong.

Should we just keep track a list of Pages on Site that aren't being built?

@bep bep added the Bug label Jun 13, 2016
@bep bep changed the title bug: Site page stats counters Site page stats counters on rebuilds Jun 13, 2016
@g3wanghc
Copy link
Contributor Author

I will work on this.

@bep bep added this to the v0.17 milestone Aug 4, 2016
@bep bep self-assigned this Aug 4, 2016
bep added a commit that referenced this issue Aug 4, 2016
Work In Progress!

This commit makes a rework of the build and rebuild process to better suit a multi-site setup.

This also includes a complete overhaul of the site tests. Previous these were a messy mix that
were testing just small parts of the build chain, some of it testing code-paths not even used in
"real life". Now all tests that depends on a built site follows the same and real production code path.

See #2309
Closes #2211
Closes #477
Closes #1744
bep added a commit that referenced this issue Aug 8, 2016
Work In Progress!

This commit makes a rework of the build and rebuild process to better suit a multi-site setup.

This also includes a complete overhaul of the site tests. Previous these were a messy mix that
were testing just small parts of the build chain, some of it testing code-paths not even used in
"real life". Now all tests that depends on a built site follows the same and real production code path.

See #2309
Closes #2211
Closes #477
Closes #1744
bep added a commit that referenced this issue Aug 13, 2016
Work In Progress!

This commit makes a rework of the build and rebuild process to better suit a multi-site setup.

This also includes a complete overhaul of the site tests. Previous these were a messy mix that
were testing just small parts of the build chain, some of it testing code-paths not even used in
"real life". Now all tests that depends on a built site follows the same and real production code path.

See #2309
Closes #2211
Closes #477
Closes #1744
bep added a commit that referenced this issue Aug 15, 2016
Work In Progress!

This commit makes a rework of the build and rebuild process to better suit a multi-site setup.

This also includes a complete overhaul of the site tests. Previous these were a messy mix that
were testing just small parts of the build chain, some of it testing code-paths not even used in
"real life". Now all tests that depends on a built site follows the same and real production code path.

See #2309
Closes #2211
Closes #477
Closes #1744
bep added a commit that referenced this issue Aug 20, 2016
Work In Progress!

This commit makes a rework of the build and rebuild process to better suit a multi-site setup.

This also includes a complete overhaul of the site tests. Previous these were a messy mix that
were testing just small parts of the build chain, some of it testing code-paths not even used in
"real life". Now all tests that depends on a built site follows the same and real production code path.

See #2309
Closes #2211
Closes #477
Closes #1744
bep added a commit that referenced this issue Aug 20, 2016
Work In Progress!

This commit makes a rework of the build and rebuild process to better suit a multi-site setup.

This also includes a complete overhaul of the site tests. Previous these were a messy mix that
were testing just small parts of the build chain, some of it testing code-paths not even used in
"real life". Now all tests that depends on a built site follows the same and real production code path.

See #2309
Closes #2211
Closes #477
Closes #1744
@bep bep closed this as completed in 708bc78 Sep 6, 2016
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
Work In Progress!

This commit makes a rework of the build and rebuild process to better suit a multi-site setup.

This also includes a complete overhaul of the site tests. Previous these were a messy mix that
were testing just small parts of the build chain, some of it testing code-paths not even used in
"real life". Now all tests that depends on a built site follows the same and real production code path.

See gohugoio#2309
Closes gohugoio#2211
Closes gohugoio#477
Closes gohugoio#1744
@github-actions
Copy link

github-actions bot commented Apr 3, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants