2007-10-11
2007-10-11 11:48:45 by Henrik Grubbström (Grubba) <grubba@grubba.org>
-
b9e5cb77487a497782e6fb10b41eb07442a49a00
(17 lines)
(+13/-4)
[
Show
| Annotate
]
Branch: 5.2
Made BackgroundProcess more robust against errors.
Rev: server/base_server/roxen.pike:1.971
6:
// Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.
// ABS and suicide systems contributed freely by Francesco Chemolli
- constant cvs_version="$Id: roxen.pike,v 1.970 2007/09/20 10:28:13 grubba Exp $";
+ constant cvs_version="$Id: roxen.pike,v 1.971 2007/10/11 11:48:45 grubba Exp $";
//! @appears roxen
//!
1116: Inside #if defined(DEBUG)
if (self_refs < 4)
error ("Minimum ref calculation wrong - have only %d refs.\n", self_refs);
#endif
- if (stopping || self_refs <= 4) return;
+ if (stopping || (self_refs <= 4) || !func) return;
+ mixed err = catch {
func (@args);
-
+ };
+ if (err) {
+ catch {
+ report_error(LOC_M(0, "Uncaught error in background process:") +
+ "%s\n", describe_backtrace(err));
+ };
+ }
background_run (period, repeat, func, args);
}
4229:
//! Invalidate (mark as stale) a cache key.
void invalidate(CacheKey key)
{
- if (!key) return;
+ if (invalidp(key)) return;
catch {
if (key->invalidate) {
key->invalidate();