Explorar el Código

catch ratelimit exception but not tested

master
patrick hace 6 años
padre
commit
47e5928738
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  1. +9
    -2
      Xero.php

+ 9
- 2
Xero.php Ver fichero

namespace Biukop; namespace Biukop;


use \XeroPHP\Application\PrivateApplication; use \XeroPHP\Application\PrivateApplication;
use \XeroPHP\Remote\Exception\RateLimitExceededException;

class Xero { class Xero {
private $xero; private $xero;
private $clientgroup="48646f3d-cf5e-4fea-8c8b-5812bd540e1b"; private $clientgroup="48646f3d-cf5e-4fea-8c8b-5812bd540e1b";
//sync users to wordpress system //sync users to wordpress system
//does not work for too many users or employees //does not work for too many users or employees
public function sync_users(){ public function sync_users(){
$this->sync_clients();
$this->sync_employees();
try{
$this->sync_clients();
$this->sync_employees();
}catch(RateLimitExceededException $e){
$msg= "Xero API rate limit exceeded, please try again later, existing sync within 600 seconds will by passed automatically\n";
$this->logConsole($msg);
}
} }
private function sync_clients(){ private function sync_clients(){
$contacts = $this->getClients($this->clientgroup); $contacts = $this->getClients($this->clientgroup);

Cargando…
Cancelar
Guardar