Closed (fixed)
Project:
Shorten URLs
Version:
6.x-1.5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Jan 2010 at 18:57 UTC
Updated:
3 Feb 2010 at 05:30 UTC
by default if the shorten fails it gets cached for three weeks. This is bad. 10 mins is a more reasonable time to cache a failed url.
Fortunately the hook_shorten_create() can be used to work round this.
/* hook shorten_create */
/* Force a short cache on failed shorten attempts */
function my_module_shorten_create($orig,$url,$service) {
if ($url != $orig) { return; }
$expire = time() + 600; //10 mins
cache_set($orig, $url, 'cache', $expire);
}
Comments
Comment #1
icecreamyou commentedGood catch. However, your solution caches the failed URL twice. I've implemented a fix in dev that changes failed URLs to only be cached for 30 minutes.
Comment #2
jpp commentedIt's was a kludge to overwrite the bad cache expire with a shorter one - the fix in -dev is much better