List Info

Thread: serious issues: sections, modes, stale cache




serious issues: sections, modes, stale cache
user name
2007-04-15 13:39:40
Hi Rick and others -

I hope you can help me on these troublesome issues with Mephisto platform. This is not my first time using it - I've been happily writing away on prototypejs.org (and other sites) for some time now, but this time my section setup is reverse: the home section is not blog but paged, and the other section is named "blog" and is of blog type . The reason for this is that I want to have /about, /feedback and similar pages as articles in Home, and blog articles in /blog/2007/.../permalink URL form. I'm using trunk and all tests pass (except the one about Iconv sanitizing special chars in permalinks, but that's not an issue ATM).

I'm troubled by permalinks. If I loop through section.pages in Home section and link_to_page every one, correct navigation is generated. But I need to check if I'm on the home page, so I wanted to check if article.url is "/". Turns out home article.url is "/2007/4/14/home". Ummm, okaay ... Why is that? (Same for other articles in the Home section - different permalink, of course.) So I solved it with a simple "if article.url =~ /home/" check (for now).

That conditional served the purpose of showing the last 3 articles from the Blog section just on the home page: site.find_section(9;blog').latest_articles(3). I'm looping over them and using link_to_article. The Blog section is available on /blog URL, but turns out the generated links don't have the "/blog" prefix; instead, they look like "/2007/4/14/first-post";. Ummm ... what happened to the prefix? So I go on and click the link only to see Mephisto crash with a template error. Turns out it wants to render the "page" template that is not there. Of course it's not, I never needed it before. It's not in the default template either. The basic templates I have are archive, error, home, search, section, single and tag. I started to dig into Mephisto rendering code only to found out my knowledge of template types and available modes was shallow in reality. How does mode relate to what template is being rendered? What are the semantics of :page mode vs. "page" template vs. single? And why does it want to render the "page" template for a blog section?

Next in line we have the stale cache problem. Sometimes, on prototypejs.org, we needed to explicitly clear the cache for a particular updated article . That was a pain, but it was relatively rare in occurrence. Now I have the same problem, but much more often (Apache proxy to Mongrel cluster). Does anyone else also have it? Is the sweeper broken?

Thanks for listening.




--~--~---------~--~----~------------~-------~--~----~
Mephisto: http://mephistoblog.com | Mephisto Help: http://mephisto.stikipad.com

To post to this group, send email to MephistoBloggooglegroups.com
To unsubscribe from this group, send email to MephistoBlog-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/MephistoBlog
-~----------~----~----~----~------~----~------~--~---

Re: serious issues: sections, modes, stale cache
user name
2007-04-15 14:55:09
On 4/15/07, Mislav Marohniæ <mislav.marohnicgmail.com> wrote:
> Hi Rick and others -
>
> I hope you can help me on these troublesome issues with
Mephisto platform.
> This is not my first time using it - I've been happily
writing away on
> prototypejs.org (and other sites) for some time now,
but this time my
> section setup is reverse: the home section is not blog
but paged, and the
> other section is named "blog" and is of blog
type . The reason for this is
> that I want to have /about, /feedback and similar pages
as articles in Home,
> and blog articles in /blog/2007/.../permalink URL form.
I'm using trunk and
> all tests pass (except the one about Iconv sanitizing
special chars in
> permalinks, but that's not an issue ATM).
>
> I'm troubled by permalinks. If I loop through
section.pages in Home section
> and link_to_page every one, correct navigation is
generated. But I need to
> check if I'm on the home page, so I wanted to check if
article.url is "/".
> Turns out home article.url is
"/2007/4/14/home". Ummm, okaay ... Why is
> that? (Same for other articles in the Home section -
different permalink, of
> course.) So I solved it with a simple "if
article.url =~ /home/" check (for
> now).

This is one of the things I'd like fixed for Mephisto 1.0. 
Right now,
all articles have a standard blog permalink in the
/yyyy/mm/dd/permalink format.  You can change this in the
site
settings, but it affects all your articles.  So, my thought
is
assigning a 'default' section to an article.  This default
section
would define the permalink style and the prefix.  Articles
in your
/blog section would still use the same permalink style
above, with a
full permalink of /blog/yyyy/mm/dd/permalink.  Paged
sections would
just use a permalink style of just 'permalink.'  Then the
only real
difference between blog and page sections are that one
queries 15
articles orderd by published_at, and another queries just 1,
based on
the position order.

> That conditional served the purpose of showing the last
3 articles from the
> Blog section just on the home page:
> site.find_section('blog').latest_articles(3). I'm
looping over them and
> using link_to_article. The Blog section is available on
/blog URL, but turns
> out the generated links don't have the
"/blog" prefix; instead, they look
> like "/2007/4/14/first-post". Ummm ... what
happened to the prefix? So I go
> on and click the link only to see Mephisto crash with a
template error.
> Turns out it wants to render the "page"
template that is not there. Of
> course it's not, I never needed it before. It's not in
the default template
> either. The basic templates I have are archive, error,
home, search,
> section, single and tag. I started to dig into Mephisto
rendering code only
> to found out my knowledge of template types and
available modes was shallow
> in reality. How does mode relate to what template is
being rendered? What
> are the semantics of :page mode vs. "page"
template vs. single? And why does
> it want to render the "page" template for a
blog section?

That sounds like a weird bug.  There used to be a template
hierarchy,
but now it should only look for a template of the same name
as the
mode.  Though, you can override this in your site and
section
settings.  That's how the home template is used: it's just
the
overridden template for the main section.

> Next in line we have the stale cache problem.
Sometimes, on prototypejs.org,
> we needed to explicitly clear the cache for a
particular updated article .
> That was a pain, but it was relatively rare in
occurrence. Now I have the
> same problem, but much more often (Apache proxy to
Mongrel cluster). Does
> anyone else also have it? Is the sweeper broken?

I haven't seen any issues here.  There is a more verbose
caching mode
(commented out in environment.rb), and some integration
caching tests.
 It might be some weird edge case with some specific
conditions that
the sweeper is failing on.

-- 
Rick Olson
http://lighthouseapp.com
http://weblog.techno-
weenie.net
http://mephistoblog.com

--~--~---------~--~----~------------~-------~--~----~
Mephisto: http://mephistoblog.com |
Mephisto Help: http://mephisto.stikipad
.com

To post to this group, send email to MephistoBloggooglegroups.com
To unsubscribe from this group, send email to
MephistoBlog-unsubscribegooglegroups.com
For more options, visit this group at http
://groups-beta.google.com/group/MephistoBlog
-~----------~----~----~----~------~----~------~--~---

Re: serious issues: sections, modes, stale cache
user name
2007-04-15 16:55:15
Mislav,

On 4/15/07, Rick Olson < technoweeniegmail.com">technoweeniegmail.com> wrote:
On 4/15/07, Mislav Marohniæ < mislav.marohnicgmail.com">mislav.marohnicgmail.com> wrote:
>; Hi Rick and others -
>
>; I hope you can help me on these troublesome issues with Mephisto platform.
> This is not my first time using it - I've been happily writing away on
> prototypejs.org (and other sites) for some time now, but this time my
> section setup is reverse: the home section is not blog but paged, and the
> other section is named "blog" and is of blog type . The reason for this is
> that I want to have /about, /feedback and similar pages as articles in Home,
> and blog articles in /blog/2007/.../permalink URL form. I'm using trunk and
> all tests pass (except the one about Iconv sanitizing special chars in
> permalinks, but that's not an issue ATM).
>
> I'm troubled by permalinks. If I loop through section.pages in Home section
&gt; and link_to_page every one, correct navigation is generated. But I need to
> check if I'm on the home page, so I wanted to check if article.url is "/&quot;.
> Turns out home article.url is "/2007/4/14/home". Ummm, okaay ... Why is
> that? (Same for other articles in the Home section - different permalink, of
> course.) So I solved it with a simple "if article.url =~ /home/&quot; check (for
> now).

This is one of the things I'd like fixed for Mephisto 1.0. ; Right now,
all articles have a standard blog permalink in the
/yyyy/mm/dd/permalink format.&nbsp; You can change this in the site
settings, but it affects all your articles.&nbsp; So, my thought is
assigning a 'default' section to an article.&nbsp; This default section
would define the permalink style and the prefix.&nbsp; Articles in your
/blog section would still use the same permalink style above, with a
full permalink of /blog/yyyy/mm/dd/permalink. ; Paged sections would
just use a permalink style of just 'permalink.'&nbsp; Then the only real
difference between blog and page sections are that one queries 15
articles orderd by published_at, and another queries just 1, based on
the position order.
I have tried to achieve exactly the same thing and reached the same conclusion that you have, Mislav.&nbsp; 2 possible approaches for now:

In your template, (harder in liquid though), you can test what case you are in.  For example, for a blog section (using variables accesible in erb or haml templates):
mode == :single
section == nil
article != nil
article.section[0].name == "blog"

If all of the above condition are true, then you are displaying an article in you blog section.&nbsp; (this assumes that the first section your article appears in is the "blog" section.

For the section itself, it should work as is, but here are the conditions you can watch for:
mode == :section
article == nil
section != nil
section.name == "blog"

The other alternative I started investigating (but have not completed yet), is to add a ":section" variable for the permalinks variables, and for it to use the section (somewhat similar to what Rick is suggesting).  This looked like a minimally intrusive change and could work (but unfortunately I stopped halfway and was planning to get back to it later).
&nbsp;

> That conditional served the purpose of showing the last 3 articles from the
> Blog section just on the home page:
> site.find_section(9;blog').latest_articles(3). I'm looping over them and
> using link_to_article. The Blog section is available on /blog URL, but turns
>; out the generated links don't have the "/blog" prefix; instead, they look
> like "/2007/4/14/first-post";. Ummm ... what happened to the prefix? So I go
> on and click the link only to see Mephisto crash with a template error.
&gt; Turns out it wants to render the "page" template that is not there. Of
> course it's not, I never needed it before. It's not in the default template
&gt; either. The basic templates I have are archive, error, home, search,
&gt; section, single and tag. I started to dig into Mephisto rendering code only
> to found out my knowledge of template types and available modes was shallow
&gt; in reality. How does mode relate to what template is being rendered? What
> are the semantics of :page mode vs. "page" template vs. single? And why does
> it want to render the "page" template for a blog section?

That sounds like a weird bug.  There used to be a template hierarchy,
but now it should only look for a template of the same name as the
mode.&nbsp; Though, you can override this in your site and section
settings.&nbsp; That's how the home template is used: it's just the
overridden template for the main section.

> Next in line we have the stale cache problem. Sometimes, on prototypejs.org,
>; we needed to explicitly clear the cache for a particular updated article .
> That was a pain, but it was relatively rare in occurrence. Now I have the
> same problem, but much more often (Apache proxy to Mongrel cluster). Does
> anyone else also have it? Is the sweeper broken?

I haven't seen any issues here. ; There is a more verbose caching mode
(commented out in environment.rb), and some integration caching tests.
It might be some weird edge case with some specific conditions that
the sweeper is failing on.
I have seen the same issues, but have not investigated the root cause.&nbsp; With apache rewriting rules (using fcgi but this should not be relevant) setup so that 100% of the request can be served by apache once cached (somewhat different from all the solutions I've found online), I have to manually remove the cache (for updates to articles or comments).  And in most cases also clear the browser cache.&nbsp; My guess is that the cached files are not always being deleted when they should, and that the expiration date is too far in the future, but for now, this has not been a big enough problem for me to address.

Cheers,
Pascal.
--
http://blog.nanorails.com
 ;

--
Rick Olson
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com





--~--~---------~--~----~------------~-------~--~----~
Mephisto: http://mephistoblog.com | Mephisto Help: http://mephisto.stikipad.com

To post to this group, send email to MephistoBloggooglegroups.com
To unsubscribe from this group, send email to MephistoBlog-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/MephistoBlog
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )