Display a message when data is unavailable

toddwoof - October 27, 2008 - 16:15
Project:Book Post
Version:6.x-1.2-beta1
Component:Code
Category:feature request
Priority:normal
Assigned:rubinsztajn
Status:needs work
Description

Recently OpenLibrary has been down a lot. The resulting display for Book Post fields is a bunch of field labels, no data, and the generic book cover. In a view of books, it's even more disconcerting: a bunch of empty items.

I wonder if it would be feasible to have some kind of default "this feature is unavailable right now" message that would display if the application can't reach OpenLibrary. Or, alternatively, to pull the data from OpenLibrary and save it in Drupal, maybe in some kind of cache, instead of looking it up each time.

#1

nbchip - October 29, 2008 - 03:49

I agree that idea of some kind of caching or making CCK field would be both more economic and user friendly, cause curl query takes lots of time and also it seems that OpenLibrary is often down.

#2

rubinsztajn - October 29, 2008 - 16:58
Assigned to:Anonymous» rubinsztajn

The caching and CCK field ideas both make a lot of sense. I'll look at these for the next release. Thanks!

#3

rubinsztajn - November 3, 2008 - 16:43

I realized I forgot to ask whether either of you have caching enabled. Setting caching to "normal" should save the module from having to call the Open Library with every page request. This won't work for the book covers but will work for the rest of the data, which is the most expensive part of the api call.

I'll still include a cache table in the next release. This should keep the covers on hand when the Open Library is down.

Thanks!

#4

toddwoof - November 5, 2008 - 19:57

At this point I don't have caching enabled, since I've been making changes to the site. Sounds like a good idea.

I think cache table for book data would be a great feature. Thanks!

#5

nbchip - November 6, 2008 - 03:42

I still didnt test with caching enabled, also i think there should be more user friendly way then doing this
if ($output == "") throw new Exception("Open Library Data Unavailable");
Good luck with CCK and table caching ;) Thanks.

#6

cborders - August 21, 2009 - 05:25

Yeah, this takes down my whole site. So if Open Library is down, I'm down! I'll see what I can so, maybe just post a message or display just have the box be empty or something.

#7

cborders - August 21, 2009 - 05:59

Here's a quick fix that I came up with. All it does is return an empty div if it can't get the information from Open Library. This seems to be a pretty graceful failure. Just rename the attachment to bookpost.module and replace the one in modules/bookpost

AttachmentSize
bookpost.txt 7.89 KB

#8

jgoodwill01 - September 15, 2009 - 11:51

Has there been any progress made on a new version of this module? I love using it and would really enjoy a cache table for this. If I had a little more programing ability I would help with this but at the moment I'm still a little lacking in that department.

+1 for cache.

#9

rubinsztajn - September 16, 2009 - 16:49
Status:active» needs work

Hey, cborders. Thanks for the patch! I think this is the right idea for a graceful failure if the Open Library is down. I just finished grad school so I can finally stop being a neglectful project maintainer. Adding the cache table will probably change how the code responds to OL being down so I'll decide how to handle that as caching develops.

Submitting actual patches using diff is a lot easier on maintainers. Drupal also has pretty strict code style requirements. You can find info on submitting patches here, http://drupal.org/patch/submit.

Again, thanks for your help.

 
 

Drupal is a registered trademark of Dries Buytaert.