maybe a better approach:
```javascript
var timeoutId;

onsuccess = function() {
  ...
  clearTimeout(timeoutId);
}

onerror = function() {
  clearTimeout(timeoutId);
}
...

timeoutId = setTimeout( ... log ... callback);
```

`clearTimeout` works fine if the timeout already fired.