Re: set_display_context_callback() and incorrect pagination
Bharat Mediratta <[email protected]> Mon, 28 Jan 2013 08:02:18 -0800
| Newsgroups | gmane.comp.web.gallery.devel |
|---|---|
| Message-ID | <CAESa+_kx=kW58P7ctaTLQiwjsBT+e+DMGex02H3VpfYY0UAy9w@mail.gmail.com> |
I'm trying to work through what you're saying. It sounds like the latestupdates module is creating an album that's huge (11k siblings?) and the Grey Dragon theme is trying to do an operation on every sibling when it does a page render. So then theoretically GD can't handle any really large album (and it'll get slower as albums get larger). Does that sound right? I'm not 100% happy with the display context code. As designed, it allows us to keep track of logical groupings of items (search results, tags, etc) as separare from the "physical" groupings (albums). That part is fine. The part that's messy is that we store the context in your session so that we don't have to clutter the url with it. That part I don't like because it means that there's a hidden piece of information that governs what the resulting UI is going to look like and that hidden piece of information propagates separately from the URL. It's caused us problems in the past - like when you click on a random image from a search results page it tries to show that random image in the context of your search results. I'm in favor of actually creating a new URL path per context to resolve this, but if I recall correctly there were problems with doing that. I can't remember what they were, though - I'd have to investigate. If somebody would like to take a shot at this, I'd be happy to help. On the crashing problem - this is a GD issue. It's not a good idea to attempt to do operations on an open-ended number of siblings. It's eventually going to hit a resource limit. GD needs to restrain itself in some fashion... -Bharat On Sat, Jan 26, 2013 at 11:40 AM, Mike Miller <[email protected]> wrote: > Hi All, > > I think I've identified a bug (mostly cosmetic in Wind, fatal in Grey > Dragon), but I'm not sure how to fix it. > > The original symptom I noticed (in Grey Dragon) is that if I use > either the dynamic or the latestalbums modules to see recent items, > and then click on one of the images, the page aborts loading right > after the heading. If I click on the parent album (using a breadcrumb > or by typing a URL manually), and then try to return to the photo's > page again, it loads properly. > > A quick investigation revealed that GD's paginator is trying to load > each sibling, and although sibling_count is 11912 for me (the number > of items in my gallery), it fails to retrieve a specific sibling > (corresponding to the the number of items in the album (i.e., the > actual sibling count) plus 1). It seems that when the items are loaded > via latestupdates or dynamic, a call to set_display_context_callback() > is made, and this sets the function that returns the "global variable" > $total which is based on sibling_count (in > modules/gallery/libraries/Gallery_View.php). If I examine the > g3_caches table, I can confirm that when viewing the photo page, the > callback is set to something like > latestupdates_Controller::get_display_context. Opening the album page > resets this (in modules/gallery/controllers/albums.php) and then the > count is set correctly. > > In Wind, it's less severe; the paginator doesn't try to retrieve > information about the sibling, so the only effect is that despite the > fact that the URL is /path/to/actual/album/name/PHOTO, the paginator > says "XXX of <TOTAL NUMBER>" rather than "XXX of <ITEMS IN ALBUM>" > > If this was a G2 like setup where I was accessing a URL as > /latestupdates/PHOTO_NAME instead of /album/name/PHOTO_NAME, I could > understand the need to show it as part of the virtual album. But in > G3, once I've clicked to a full URL, the fact that I was once upon a > time in /latestupdates/ presumably shouldn't matter; there's no > indication to the user who see /album/name/PHOTO_NAME in his browser > that the information is being calculated as though he's paging through > latestupdates's listing. > > That said, without disabling the call to Cache::instance()->set() in > set_display_context_callback (in modules/gallery/helpers/item.php), > I'm not sure how to fix this. > > Any ideas? > > -- Mike > > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnnow-d2d > __[ g a l l e r y - d e v e l ]_________________________ > > [ list info/archive --> http://gallery.sf.net/lists.php ] > [ gallery info/FAQ/download --> http://gallery.sf.net ] > > ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d __[ g a l l e r y - d e v e l ]_________________________ [ list info/archive --> http://gallery.sf.net/lists.php ] [ gallery info/FAQ/download --> http://gallery.sf.net ]