function progress(RequestContext $c) { try { $w = $this->takeWidgetFromURI($c); $fiveSecs = Time\readInterval('5 seconds'); $w->updateBalance(Bitcoin\getBalance($w->bitcoinAddress, $maxCacheAge = $fiveSecs)); return $this->textResponse($w->progressPercent); } catch (\SpareParts\WebClient\NetworkError $e) { Log\notice("Caught " . get_class($e) . " when attempting to check Bitcoin-address balance: " . $e->getMessage()); return $this->textResponse("Network error occurred when trying to check address balance", 503); } }
protected function notice($msg) { Log\notice($msg); }