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

Feature: Better assets pipelining #917

Merged

Conversation

Sommerregen
Copy link
Contributor

This PR is an enhancement of PR #906, where we have used the cache key as a stable key for pipeline generation. Now whenever an asset has changed the pipeline will be regenerated again. This is possible, because a modification time is added to each (local) asset. Remote assets are ignored so far, since it is difficult to actually retrieve a reliable modification time...

@Sommerregen Sommerregen force-pushed the feature/better-assets-pipelining branch from b7b68c7 to 4cb8a04 Compare June 25, 2016 17:10
@Sommerregen Sommerregen changed the title Feature/better assets pipelining Feature: Better assets pipelining Jun 25, 2016
@rhukster rhukster merged commit 1fb2d73 into getgrav:develop Jul 11, 2016
@MoisesCardenas
Copy link

MoisesCardenas commented Feb 26, 2017

I encountered a issue on how the $uid is been generated and want to get some feed back, on our current environment we have two servers under a load balancer, the two servers contains an exact copy of the Grav website and this had been working really well until we enabled the Pipeline feature, we started getting 404 on css and on js even that the assets where inserted on the html "/assets/f51423af2c4b570cd1e444013972b42c.css", I did some tests and I found the problem:

$uid = md5(json_encode($this->css) . $this->css_minify . $this->css_rewrite . $group);
and
$uid = md5(json_encode($this->js) . $this->js_minify . $group);

The arrays $this->css and $this->js contains a property called "modified" which will always be different for each server and will make the $uid to be different for the same resources, this caused a weird behavior where some times the page loads with uids names of resources that only exists on server 2 and vice versa, therefore the 404.

I was able to fix this by removing the json_encode($this->css) and json_encode($this->js) from the md5 after that the uid names on the assets matched regardless of the server so no more 404 and the page was loading correctly, I think this is not and ideal solution, any thoughts on this?

@flaviocopes
Copy link
Contributor

I think you need session persistence to make sure that users are always directed to the same server during the same session, otherwise you'll also run into cookies / session issues. The same issue applies to cached resources like processed images, which are stored with a random name.

@MoisesCardenas
Copy link

MoisesCardenas commented Feb 27, 2017

@flaviocopes that in deed is the way to go I complete forgot that AWS ELB has a feature called sticky sessions which will make users to always hit the same server during the session, I enabled it and now the website is working like a charm.

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.

4 participants