By hanskuiters on
For a new site I get content from an external database application (we own it, no hacking). With different parameters I construct an url and the api returns an xml feed. The xml result gets themed in a block. Every block has its own parameters. All in a custom module.
Now today there was a problem with the external database. No big problem, it is all still under development. But that raised an issue: the website stopped loading.
My question: how can I prevent the website stop loading if the external database doesn't respond (quick enough)? Do I need to check response time, or do I ping? Or anything else?
Thanks for thinking with me.
Comments
2 ideas: 1. download the
2 ideas:
1. download the content of the block cron time, store it, and display it from the database
2. write a separate PHP to display content, and load it into an iframe ina block
Nice approaches. Not sure
Nice approaches. Not sure about iframe, so I'll focus on the first option. Thanks.
Yep, good suggestions
Yeah, put the external dependency into a cron job and cache it.
It's unlikely you'd be needing to reload a read-only data source every page load. probably very inefficient + fragile
(if you really DO need time-dependent fresh stuff each refresh, then AJAX that requests the data (eg via json) post-load means it won't slow the page load down. Some assembly required to get it all smooth though. )
.dan. is the New Zealand Drupal Developer working on Government Web Standards
I worked on caching. Not
I worked on caching. Not finished yet but looking good allready. Thanks for the help.