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

icecreamyou’s picture

Status: Active » Fixed

Good 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.

jpp’s picture

It's was a kludge to overwrite the bad cache expire with a shorter one - the fix in -dev is much better

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.