• Resolved pleonard

    (@pleonard)


    So I think this is something new in 3.0: items in Zotero with “child” items (such as a web page snapshot) seem to cause a long delay when first loading. The delay disappears once the items are cached, but it’s a significant delay that (at least on Mac OS) seems to cause the browser to freeze for its duration. Here’s an example: this page includes two references, one with and one without a ‘child’ element.

    http://32by32.com/switcher/

    First reference:
    http://www.zotero.org/32by32/items/7FVVZQGJ

    Second reference:
    http://www.zotero.org/32by32/items/5TPCPURK

    Child element of second reference:
    http://www.zotero.org/32by32/items/JGI5KTCC

    There are three copies of zotpress.rss.php spawned for the page — If I’m correct, one for the two main references and then one for the child of the second reference. The first two take 700ms and 240ms to execute, respectively. But the third one takes a whole two and a half seconds. If you multiply that times a page with a lot of child elements you can imagine the delay that might build up.

    It’s possible that the Zotero server API is introducing these delays… Here’s the interesting question: does Zotpress need to fetch these child elements at all? As far as I know, the URL of a given citation is stored in the record itself, so Zotpress could just ignore any child element (such as a web page snapshot) and perhaps speed up the retrieval process.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Katie

    (@kseaborn)

    First off, really appreciate all the feedback you’ve been giving!

    I have some idea what’s causing delays. A part of it is the Zotero server, and I believe the kindly folk there are working on it. Another part of it is how requests are made: the number of requests to Zotero will match the number of shortcode calls, e.g. if you have one [zotpress] shortcode that’s one request, but if you have a lot of individual [zotpress] shortcodes then you’ll have a lot of individual requests to Zotero, which will slow things up.

    A sort-of related part is that I’m making a trade-off by having the Ajax synchronous — the “freeze” delay is a result of how the browser deals with it.

    I don’t know why child elements take longer to load. Zotpress requests the child page for its download URL, which is different than any other meta URL and is NOT static, being dynamically generated by the provider and tending to expire after a while.

    After all this — I meant to implement a different approach displaying shortcodes in Zotpress 3 but decided to push out the rest of the new stuff and fixes since it’ll take a lot of re-writing to implement. The plan is to display whatever’s in the db right off the bat, then asynchronously check for updates in the background.

    Thread Starter pleonard

    (@pleonard)

    Thanks for the info! So the way I’ve actually implemented Zotpress on my site is through (manual) unification of the WordPress basename and the Zotero tag namespaces. At the end of every post, I call a theme function which looks like this:

    function showcites() {
    	$postid = $wp_query->post->ID;
    	$slug = basename(get_permalink($postid));
    	echo '<div class="citationheader">References:</div>';
    	echo '<div class="citations">';
    	echo do_shortcode ('[zotpress tag_name="' . $slug . '"]');
    	echo '</div>';
    }

    This way one call to Zotpress retrieves all entries tagged with the basename of that particular article. (This essentially turns Zotpress into a per-article reference system, which is how I’m using it.)

    So the three queries to Zotero in the page above (two articles and one child item) are actually coming from one shortcode call…

    Thanks again for a great tool!

    Plugin Author Katie

    (@kseaborn)

    Zotpress is making two calls per shortcode because the desired content is split between two request types: content=html and content=bib. The first one provides the styled citation. The second one provides extracted information like date, author, and supplied citation url. If there’s a third request, it’s the dynamically generated download link.

    It would be great if Zotero could provide a bib+html content type … in fact, I think I’ll go make a request in the forum.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: Zotpress] Child items causing loading delays?’ is closed to new replies.